2017年11月30日 星期四

bash processing bar


https://stackoverflow.com/questions/12498304/using-bash-to-display-a-progress-working-indicator

/usr/bin/scp me@website.com:file somewhere 2>/dev/null &
pid=$! # Process Id of the previous running command

spin[0]="-"
spin[1]="\\"
spin[2]="|"
spin[3]="/"

echo -n "[copying] ${spin[0]}"
while [ kill -0 $pid ]
do
  for i in "${spin[@]}"
  do
        echo -ne "\b$i"
        sleep 0.1
  done
done

William Pursell's solution
/usr/bin/scp me@website.com:file somewhere 2>/dev/null &
pid=$! # Process Id of the previous running command

spin='-\|/'

i=0
while kill -0 $pid 2>/dev/null
do
  i=$(( (i+1) %4 ))
  printf "\r${spin:$i:1}"
  sleep .1
done


2017年11月24日 星期五

HACMP mirror 回 MISS 的 PV

System Management (C-SPOC)

 Storage

Volume Groups

Unmirror a Volume Group

ldapvg          f7b7_rg                    f7n7,f7n8

   f7n7                  hdisk5 

--
                                                                              Unmirror a Volume Group

Type or select values in entry fields.
Press Enter AFTER making all desired changes.
 
                                                        [Entry Fields]
  VOLUME GROUP name                                   ldapvg
  Resource Group Name                                 f7b7_rg
  Node List                                           f7n7,f7n8
  Reference node                                      f7n7
  PHYSICAL VOLUME names                               hdisk5
 
  Number of COPIES of each logical                    1                                                                                                                         +
    partition

--

Command: running       stdout: no            stderr: no

Before command completion, additional instructions may appear below.
--
Command: OK            stdout: no            stderr: no

Before command completion, additional instructions may appear below.

--
ibmldap-online:/admin> lsvg -l ldapvg
ldapvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
loglv00             jfs2log    1       1       1    open/syncd    N/A
fslv01              jfs2       1920    1920    1    open/syncd    /home
ibmldap-online:/admin>
--
ibmldap-online:/admin> smitty hacmp
--
System Management (C-SPOC)
 Storage
Volume Groups
Mirror a Volume Group
ldapvg          f7b7_rg                    f7n7,f7n8           2
 f7n7                  hdisk5

--
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
 
                                                        [Entry Fields]
* VOLUME GROUP name                                   ldapvg
  Resource Group Name                                 f7b7_rg
  Node List                                           f7n7,f7n8
  Reference node                                      f7n7
  PHYSICAL VOLUME names                               hdisk5
 
  Mirror sync mode                                    Background                                                                                                                +
  Number of COPIES of each logical                    2                                                                                                                         +
    partition
  Keep Quorum Checking On?                            no                                                                                                                        +
  Create Exact LV Mapping?                            no         
--
Command: running       stdout: yes           stderr: no

Before command completion, additional instructions may appear below.

f7n7: 0516-1804 chvg: The quorum change takes effect immediately.
--

Command: OK            stdout: yes           stderr: no

Before command completion, additional instructions may appear below.

f7n7: 0516-1804 chvg: The quorum change takes effect immediately.

--
ibmldap-online:/admin> lsvg -l ldapvg
ldapvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
loglv00             jfs2log    1       2       2    open/syncd    N/A
fslv01              jfs2       1920    3840    2    open/stale    /home
ibmldap-online:/admin> lsvg  ldapvg 
VOLUME GROUP:       ldapvg                   VG IDENTIFIER:  00cbfcf500004c000000013773a3c920
VG STATE:           active                   PP SIZE:        16 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      6390 (102240 megabytes)
MAX LVs:            256                      FREE PPs:       2548 (40768 megabytes)
LVs:                2                        USED PPs:       3842 (61472 megabytes)
OPEN LVs:           2                        QUORUM:         1 (Disabled)
TOTAL PVs:          2                        VG DESCRIPTORS: 3
STALE PVs:          1                        STALE PPs:      1693
ACTIVE PVs:         2                        AUTO ON:        no
MAX PPs per VG:     32768                    MAX PVs:        1024
LTG size (Dynamic): 256 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable
ibmldap-online:/admin>
--
ibmldap-online:/admin> lsvg -p ldapvg
ldapvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk5            active            3195        1274        639..00..00..00..635
hdisk4            active            3195        1274        639..00..00..00..635
ibmldap-online:/admin>
--

2017年11月18日 星期六

CentOS7 OpenLDAP



// 掛載外部資源用
yum install nfs-utils -y

//compile check  用
yum install gcc -y

yum install openldap openldap-servers openldap-clients openldap-devel compat-openldap -y



用 slapd.conf 的方式已棄用,參考
http://www.thegeekstuff.com/2015/01/openldap-linux/

直接修改
/etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif
(但是裡面建議要用 ldapmodify , 不要直接改, 裡面有 CRC32

把 olcRootDN 跟 olcSuffix 改掉
然後用 ldappasswd 產生新密碼 在後面多加一行
olcRootPW: {SSHA}ooxxooxx <--剛剛產生的

然後測試

slaptest -u

會抱怨 CRC 不對
5a0e8ba7 ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif"

參考 https://gist.github.com/Shaltz/1d65a07a0901a36fb7f1

到  http://freecode.com/projects/checkcrc/ 下 check-4.3-src.tgz
用 tar xvf 解開 (雖然副檔名是 tgz 但是其實好像是 tar 而已)

下 zlib-devel

yum install zlib-devel -y

然後





# cd check-4.3

check4-3# gcc -O3 -Wall -DUSE_ZLIB -I/usr/include -o check check.c -L/usr/lib64 -lz

cp /etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif /tmp

tail -n +3 /tmp/olcDatabase={2}hdb.ldif > fixed.ldif

./check /tmp/fixed.ldif

fixed.ldif CRC-32 = 61e6182a, size = 582 bytes

把算好的值填回原本的檔案

# vi /etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif

AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify. 
CRC32 61e6182a

再跑測試
[root@localhost ~]# slaptest -u 
config file testing succeeded

#service slapd start

ldapsearch -x -b "o=XXXXX,c=XX"

# extended LDIF
#
# LDAPv3
# base <o=vghtc,c=tw> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# search result
search: 2
result: 32 No such object

# numResponses: 1


####
防火牆
參考 

CentOS 7 以後用  Firewalld ,  不用 iptables

[root@localhost worktmp]# cat /usr/lib/firewalld/services/ldap.xml 
<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>LDAP</short>
  <description>Lightweight Directory Access Protocol (LDAP) server</description>
  <port protocol="tcp" port="389"/>
</service>
[root@localhost worktmp]# firewall-cmd --add-service=ldap --permanent
success
[root@localhost worktmp]# firewall-cmd --reload
success


用 olc 的方式自訂 schema
http://www.zytrax.com/books/ldap/ch6/slapd-config.html#use-schemas


自訂的時候

*****************問題**********************
5a0eacd5 /etc/openldap/schema/00001.schema: line 21 attributetype: AttributeType inappropriate matching rule: "1.3.6.1.4.1.1466.109.114.1"
*******************************************

attributetype ( 1.3.6.1.4.1.9883.1001.1.2.1 NAME 'user' DESC 'User Name of FTO M2 System' SUP 2.5.4.41 EQUALITY 2.5.13.2 ORDERING 2.5.13.3 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.9883.1001.1.2.2 NAME 'gp' DESC 'Group Name of FTO M2 System' SUP 2.5.4.41 EQUALITY 2.5.13.2 ORDERING 2.5.13.3 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.9883.1001.1.2.3 NAME 'firstName' SUP 2.5.4.41 EQUALITY 2.5.13.2 ORDERING 2.5.13.3 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.9883.1001.1.2.4 NAME 'lastName' SUP 2.5.4.41 EQUALITY 2.5.13.2 ORDERING 2.5.13.3 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.9883.1001.1.2.5 NAME 'loginCount' EQUALITY 2.5.13.14 SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.9883.1001.1.2.6 NAME 'lastLoginTime' EQUALITY 2.5.13.27 ORDERING 2.5.13.28 SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.9883.1001.2.2.1 NAME 'prop' DESC 'Extended attribute values of FTO M2 System' EQUALITY 1.3.6.1.4.1.1466.109.114.1 SUBSTR 1.3.6.1.4.1.1466.109.114.1 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{20000} )
attributetype ( 1.3.6.1.4.1.9883.1001.2.2.2 NAME 'pn' DESC 'Permission name of FTO M2 SYSTEM' SUP 2.5.4.41 EQUALITY 1.3.6.1.4.1.1466.109.114.1 SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.9883.1001.2.2.3 NAME 'permissionIDs' DESC 'The DN of a permission.' SUP 2.5.4.49 )

紅字的部分會炸掉

改成這樣

attributetype ( 1.3.6.1.4.1.9883.1001.2.2.1
    NAME 'prop'
    DESC 'Extended attribute values of FTO M2 System'
    EQUALITY 2.5.13.5
    SUBSTR 2.5.13.7
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{20000} )

attributetype ( 1.3.6.1.4.1.9883.1001.2.2.2
    NAME 'pn'
    DESC 'Permission name of FTO M2 SYSTEM'
    SUP 2.5.4.41
    EQUALITY 2.5.13.5
    SINGLE-VALUE )

根據 這個  https://www.ldap.com/ldap-oid-reference
1.3.6.1.4.1.1466.109.114.1: caseExactIA5Match (RFC 4517)
1.3.6.1.4.1.1466.115.121.1.15: Directory String (RFC 4517)

根據這個 https://lists.clug.org.za/pipermail/clug-tech/2005-January/021211.html
--
I just noticed on
   http://www.openldap.org/doc/admin21/guide.html
that IA5... pertains to ASCII!

directoryString 1.3.6.1.4.1.1466.115.121.1.15 UTF-8 string
IA5String 1.3.6.1.4.1.1466.115.121.1.26 ASCII string
--

根據 這個 http://www.openldap.org/doc/admin24/schema.html

[ "SUBSTR" woid ]              ; Matching Rule name
[ "SYNTAX" whsp noidlen whsp ] ; Syntax OID
[ "EQUALITY" woid              ; Matching Rule name

所以根據這個  http://www.openldap.org/doc/admin21/guide.html#Extending Schema

caseExactIA5Match (case sensitive, space insensitive) 

好像應該要換成 

caseExactMatch (case sensitive, space insensitive)

查 https://www.ldap.com/ldap-oid-reference 知

2.5.13.5: caseExactMatch (RFC 4517)
2.5.13.7: caseExactSubstringsMatch (RFC 4517)

把 EQUALITY 改成 2.5.13.5  , SUBSTR 改成 2.5.13.7

*************************************問題***************************
AttributeType not found: "javaClassName"
*************************************
這個其實在 java.schema 裡面 , 測試的時候可以用 slapd.conf 先拉進來
不過好像也可以直接把定義抄到自己的 schema file 裡

另外還會缺的東西有 
isAccountEnabled  , fullName 先從原本那台的定義檔抄過來

測試方式

寫一個 slapd.conf 裡面放 

include  /etc/openldap/schema/My.schema 之類的

然後 mkdir testDIR

然後用 slaptest 

slaptest -f slapd.conf -F testDIR/

就會測試 然後轉 ok 的話就會把 LDIF 生在 testDIR/

參考這個  http://www.zytrax.com/books/ldap/ch6/slapd-config.html#use-schemas

要加 schame 的 LDIF 進去的話 因為要改 cn=config , 要這樣加

ldapadd -Y EXTERNAL -H ldapi:/// -f r3.ldif

不然還是會說權限不夠
--
http://idmoim.blogspot.tw/2014/05/ldapadd-insufficient-access-50-openldap.html
這篇是說直接去改 config.ldif 可是還是需要足夠的權限
--

加完這樣查
ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=config


加使用者設定檔進去

ldapadd -x -D '{RootDN}' -w {RootPW} -H ldapi:/// -f u01.ldif

********************問題**********************
adding new entry "cn=administrator,ou=users,o=XXXXX,c=XX"
ldap_add: Invalid syntax (21)
additional info: isaccountenabled: value #0 invalid per syntax


http://speeves.erikin.com/2007/01/openldap-booleanmatch-values-truefalse.html

The boolean values (TRUE/FALSE) in the LDIF file need to be UPPERCASE :P 
**********************************************


整團加進去
ldapadd -x -D '{RootDN}' -w {RootPW} -H ldapi:/// -f group.ldif

整團砍掉 ( 加 -r ) <-- 會連頭一起砍掉
ldapdelete -x -r -D '{RootDN}' -w {RootPW} -H ldapi:/// "ou=groups, o=XXXXX,c=XX"

-----------------------------------------------
不加 -r 的話要從底下開砍 不然會
ldap_delete: Operation not allowed on non-leaf (66)
        additional info: subordinate objects must be deleted first
--------------------------------------------------
***************************問題******************
description::
description:

定義上預期要有 description::
所以 LDIF 裡面碰到的是 description: 的話會炸掉
--先用 SED 處理
************************************************


lsaccountenabled 找不到?
沒有加 booleanMatch ?

-------------------------------------------


查詢RFC




[RFC4519] https://tools.ietf.org/html/rfc4519#section-2.5 

Lightweight Directory Access Protocol (LDAP):Schema for User Applications

The 'description' attribute type contains human-readable descriptive
   phrases about the object.  Each description is one value of this
   multi-valued attribute.
   (Source: X.520 [X.520])
      ( 2.5.4.13 NAME 'description'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

   1.3.6.1.4.1.1466.115.121.1.15 refers to the Directory String syntax
   [RFC4517].

   Examples: "a color printer", "Maintenance is done every Monday, at
             1pm.", and "distribution list for all technical staff".


[RFC4517 ]  https://docs.ldap.com/specs/rfc4517.txt

3.3.6.  Directory String

   A value of the Directory String syntax is a string of one or more
   arbitrary characters from the Universal Character Set (UCS) [UCS].  A
   zero-length character string is not permitted.  The LDAP-specific
   encoding of a value of this syntax is the UTF-8 encoding [RFC3629] of
   the character string.  Such encodings conform to the following ABNF:

      DirectoryString = 1*UTF8

   The <UTF8> rule is defined in [RFC4512].

      Example:
         This is a value of Directory String containing #!%#@.

   Servers and clients MUST be prepared to receive arbitrary UCS code
   points, including code points outside the range of printable ASCII
   and code points not presently assigned to any character.

   Attribute type definitions using the Directory String syntax should
   not restrict the format of Directory String values, e.g., by
   requiring that the character string conforms to specific patterns
   described by ABNF.  A new syntax should be defined in such cases.

   The LDAP definition for the Directory String syntax is:

      ( 1.3.6.1.4.1.1466.115.121.1.15 DESC 'Directory String' )

   This syntax corresponds to the DirectoryString parameterized ASN.1
   type from [X.520].

   The DirectoryString ASN.1 type allows a choice between the
   TeletexString, PrintableString, or UniversalString ASN.1 types from
   [ASN.1].  However, note that the chosen alternative is not indicated
   in the LDAP-specific encoding of a Directory String value.

   Implementations that convert Directory String values from the LDAP-
   specific encoding to the BER encoding used by X.500 must choose an
   alternative that permits the particular characters in the string and
   must convert the characters from the UTF-8 encoding into the
   character encoding of the chosen alternative.  When converting
   Directory String values from the BER encoding to the LDAP-specific
   encoding, the characters must be converted from the character
   encoding of the chosen alternative into the UTF-8 encoding.  These
   conversions SHOULD be done in a manner consistent with the Transcode
   step of the string preparation algorithms [RFC4518] for LDAP.

------------------------------------
http://www.zytrax.com/books/ldap/apc/rfc4512.txt

 <numericoid> is object identifier assigned to this attribute type;
     NAME <qdescrs> are short names (descriptors) identifying this
         attribute type;
     DESC <qdstring> is a short descriptive string;
     OBSOLETE indicates this attribute type is not active;
     SUP oid specifies the direct supertype of this type;
     EQUALITY, ORDERING, and SUBSTR provide the oid of the equality,
         ordering, and substrings matching rules, respectively;
     SYNTAX identifies value syntax by object identifier and may suggest
         a minimum upper bound;
     SINGLE-VALUE indicates attributes of this type are restricted to a
         single value;
     COLLECTIVE indicates this attribute type is collective
         [X.501][RFC3671];
     NO-USER-MODIFICATION indicates this attribute type is not user
         modifiable;
     USAGE indicates the application of this attribute type; and
     <extensions> describe extensions.

   Each attribute type description must contain at least one of the SUP
   or SYNTAX fields.  If no SYNTAX field is provided, the attribute type
   description takes its value from the supertype.
--------------------------------------------

用 ldapmodify 會把整個砍掉(?

Don't use replace, that will delete all the values. Use delete/add of the specific value.
ldapmodify -b cn={12}uri,cn=schema,cn=config
changetype: modify
delete: olcObjectClasses
olcObjectClasses: {7}
-
add: olcObjectClasses
olcObjectClasses: {7}(1.3.6.1.4.1.14092...
http://www.openldap.org/lists/openldap-technical/201408/msg00041.html
-------------------------------------------------------------

isAccountEnabled 加上 EQUALITY 2.5.13.13

依據 https://docs.ldap.com/specs/rfc4517.txt

( 2.5.13.13 NAME 'booleanMatch'
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )


------------------------------------------------------------------------
修改的方式

參考  https://serverfault.com/questions/659928/how-to-change-openldap-core-attributes

dn: cn={1}vghtc,cn=schema,cn=config
changetype: modify
delete: olcAttributeTypes
olcAttributeTypes: {10}( 1.3.18.0.2.4.726 NAME 'isAccountEnabled' DESC 'indica
 tes whether users are allowed to login using an account (true) or not (false)
 ' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7{5} SINGLE-VALUE )
-
add: olcAttributeTypes
olcAttributeTypes: {10}( 1.3.18.0.2.4.726 NAME 'isAccountEnabled' DESC 'indi
 cates whether users are allowed to login using an account (true) or not (fa
 lse)' EQUALITY 2.5.13.13 SYNTAX 1.3.6.1.4.1.1466.115.121.1.7{5} SINGLE-VALU
 E )
存成 modify001.ldif 然後
 ldapmodify -QY EXTERNAL -H ldapi:/// -f modify001.ldif

然後用
ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=config
查看看

***************************問題*******************************
ldapadd -QY EXTERNAL -H ldapi:/// -f r0.ldif        
adding new entry "o=XXXXX,c=XX"
ldap_add: Insufficient access (50)
additional info: no write access to parent
改用
ldapadd -x -W -D "cn=root,o=XX,c=XX" -f r0.ldif
Enter LDAP Password: 
adding new entry "o=XXXXX,c=XX"

***************************************************************

****************************問題*******************************
description: 格式不合

依據定義檔, description 是 Directory String 不允許空白.
( ITDS 是怎麼允許它過的? 應該有什麼覆寫吧)

所以 description: 是空的會被擋下來
先不管怎麼覆寫 用SED 全都改成新值好了

--然後用 grep 比對不到, 原來是我的匯出檔是 dos format , 
用 0A0D (CRLF) 換行


-- 用 hexdump (要另外裝) 可以把 hex dump 出來看
然後發現字碼好像是小端序(? 

--用 dos2unix 這個工具轉掉就好了 (要另外裝
dos2unix -k -n 原檔名 新檔名
-k 代表保持原本時間戳
-n 代表把改完的檔案另寫新檔  不然會直接在舊的上面改
******************************************************************

isAccountEnabled 可以 SEARCH 了,不過要用  TRUE / FALSE

[ RFC2252 ]  https://www.ietf.org/rfc/rfc2252.txt

Boolean

   ( 1.3.6.1.4.1.1466.115.121.1.7 DESC 'Boolean' )

   Values in this syntax are encoded according to the following BNF:

      boolean = "TRUE" / "FALSE"

   Boolean values have an encoding of "TRUE" if they are logically true,
   and have an encoding of "FALSE" otherwise.

ITDS 似乎是 case-insensitive 的 = =

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

整理一下要匯入 LDIF 要留意的事

1. 根要先建,建根的時候要 bind RootDN 進去不然權限不夠

2. resource , group , users 不要用 ITDS dump 的,那會帶一堆 ITDS 參數
用 LBE 匯出。匯出後要用 dos2unix 把 CRLF 抓掉

3. 抓掉 CRLF 之後用 grep  找 ": $" 空值結尾的,如果是description 這類定義成 Directory String 的就一定要給值

4. 把 isAccountEnabled 這類的 Boolean 值從  true / false 換成 TRUE / FALSE
(Ref:RFC)
--
schema_init.c:1648:booleanMatch
這邊的實作怎麼好像看起來跟實際動作不一樣?
--
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
在建SERVER時要注意的事

先用標配安裝好

然後建 db , 改 RootDN , RootPW , suffix 然後用 check 改 CRC32 填回去

vim /etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif


**
cp  /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
這不知要做啥

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
=====================================================

REF : 

https://docs.ldap.com/specs/rfc4517.txt RFC4517 ,

定義
Syntax Definitions
Matching Rule

查這個比較方便(?
https://www.iana.org/assignments/ldap-parameters/ldap-parameters.xhtml




2017年11月17日 星期五

CentOS 7 Template



/etc/sysconfig/network-scripts/ifcfg-ens192

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens192
UUID=def51bb3-2ad1-4f29-b82f-44d8f9417a19
DEVICE=ens192
ONBOOT=yes



/etc/sysctl.conf

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

好像要把IPV6抓掉還要改別的地方
https://www.linuxquestions.org/questions/linux-software-2/cenos-7-3-rpcbind-4175596401/

In CentOS 7 it appears you cannot successfully disable IPv6 via sysctl; the INET6 AF is still leaking somehow and applications will attempt to use it. The correct way to disable IPv6 and avoid this issue with rpcbind is the following:


edit /etc/default/grub

add ipv6.disable=1 to GRUB_CMDLINE_LINUX

sudo /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg

reboot

RPCBIND 爛了的話會讓 NFS 一直開不起來


改IP的工具 ( NetworkManager 的 文字版本) 
yum install NetworkManager-tui

nmtui


-------------------------------------

https://www.phpini.com/linux/centos-7-network-interface-name


CentOS 7 修改網卡名稱 Eno* 成 Eth0

在 RHEL 及 CentOS 7 開始, 網卡的預設名稱由以往的 Ethx 改成 Enox, 以下文章會介紹將 CentOS 7 網卡名稱修改, 用回 Eth0 的方法。
首先開啟檔案 “/etc/sysconfig/grub” 修改設定:
# vi /etc/sysconfig/grub
內容大概是這樣:
裡面其中一行是 GRUB_CMDLINE_LINUX, 在這行結尾的雙引號前加上這句:
net.ifnames=0 biosdevname=0
要留意, 加上以上一行資料前, 要先加上一個空格, 整行修改後是這樣:

然後用 grub2-mkconfig 指令重新建立 GRUB 的設定檔:
# grub2-mkconfig -o /boot/grub2/grub.cfg
接著要將 Eno 網卡的設定檔用 mv 改名為 eth0:
# mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eth0
編輯 /etc/sysconfig/network-scripts/ifcfg-eth0 檔案, 找到 “Name” 的一行, 改成 eth0, 全句是這樣:
NAME=eth0
​最後重新啟動系統便會生效, 要確認修改成功, 可以用 ifconfig 指令確認。
--------------------------------


Firewalld 相關路徑
/etc/firewalld:設定檔路徑
/usr/bin/:firewall-cmd 指令所在的位置
/usr/lib/firewalld/:firewalld 預設的設定資料 (xml 格式),例如 nfs.xml 就定義了 <port protocol="tcp" port="2049"/>
-------------------------------


------------------------------