読者です 読者をやめる 読者になる 読者になる

Scientific Linuxにおけるbonding設定(NetworkManager = not networkの場合)

 モジュールの起動確認は前回と同じ

# lsmod |grep bond
# modprobe --first-time bonding
# lsmod |grep bond
bonding               136630  0

 NetworkManager自体はRHEL7系からの推奨で、かつ、nmcliというCLIで設定をおこなうらしい。設定情報がどこに格納されるのかは未確認。 * まずは事前の情報化国な

# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:b3:23:42 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.50/24 brd 192.168.0.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 2402:6b00:4017:1800:a00:27ff:feb3:2342/64 scope global noprefixroute dynamic
       valid_lft 286sec preferred_lft 286sec
    inet6 fe80::a00:27ff:feb3:2342/64 scope link
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:cf:f3:c4 brd ff:ff:ff:ff:ff:ff

 で、コチラが噂のcliでみた結果。

# nmcli c
名前    UUID                                  タイプ          デバイス
enp0s8  6d2589d4-2fd4-40bd-929e-2681b45ebc4b  802-3-ethernet  --
enp0s3  995d3887-9fd0-4596-9e78-cbf2d25d7449  802-3-ethernet  enp0s3

 確かに、s3は起動していて、s8は起動していない。

  • で、ここにボンディングデバイスを追加する。
# nmcli connection add type bond autoconnect no con-name bond0 ifname bond0 mode active-backup
接続 'bond0' (1a75769d-b348-4ac8-a438-ec8f0e9a634e) が正常に追加されました。
# nmcli c
名前    UUID                                  タイプ          デバイス
enp0s8  6d2589d4-2fd4-40bd-929e-2681b45ebc4b  802-3-ethernet  --
enp0s3  995d3887-9fd0-4596-9e78-cbf2d25d7449  802-3-ethernet  enp0s3
bond0   1a75769d-b348-4ac8-a438-ec8f0e9a634e  bond            --

起動していないデバイスをbond0に引っ掛ける

# nmcli connection add type bond-slave autoconnect no ifname enp0s8 master bond0
接続 'bond-slave-enp0s8' (8e8852bf-f180-4f34-98f0-09731e9600bd) が正常に追加されました。

# nmcli c
名前               UUID                                  タイプ          デバイ ス
enp0s8             6d2589d4-2fd4-40bd-929e-2681b45ebc4b  802-3-ethernet  --     
enp0s3             995d3887-9fd0-4596-9e78-cbf2d25d7449  802-3-ethernet  enp0s3 
bond-slave-enp0s8  8e8852bf-f180-4f34-98f0-09731e9600bd  802-3-ethernet  --     
bond0              1a75769d-b348-4ac8-a438-ec8f0e9a634e  bond            --     

 下記出力をみると、bond0のslaveになっていることが確認できる。

# nmcli -f connection c s bond-slave-enp0s8
connection.id:                          bond-slave-enp0s8
connection.uuid:                        8e8852bf-f180-4f34-98f0-09731e9600bd
connection.interface-name:              enp0s8
connection.type:                        802-3-ethernet
connection.autoconnect:                 no
connection.autoconnect-priority:        0
connection.timestamp:                   0
connection.read-only:                   no
connection.permissions:
connection.zone:                        --
connection.master:                      bond0
connection.slave-type:                  bond
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:
connection.gateway-ping-timeout:        0
connection.metered:                     不明

 bondingデバイスにIPアドレスなどを設定する。

# nmcli -f ipv4 c s bond0
ipv4.method:                            auto
ipv4.dns:
ipv4.dns-search:
ipv4.addresses:
ipv4.gateway:                           --
ipv4.routes:
ipv4.route-metric:                      -1
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.never-default:                     no
ipv4.may-fail:                          yes

# LANG=C ; nmcli c e bond0

===| nmcli interactive connection editor |===

Editing existing 'bond' connection: 'bond0'

Type 'help' or '?' for available commands.
Type 'describe [<setting>.<prop>]' for detailed property description.

You may edit the following settings: connection, bond, 802-3-ethernet (ethernet), ipv4, ipv6
nmcli> set ipv4.method manual
nmcli> set ipv4.dns 192.168.0.1
nmcli> set ipv4.addresses 192.168.0.51/24
nmcli> p ipv4
['ipv4' setting values]
ipv4.method:                            manual
ipv4.dns:                               192.168.0.1
ipv4.dns-search:
ipv4.addresses:                         192.168.0.51/24
ipv4.gateway:                           --
ipv4.routes:
ipv4.route-metric:                      -1
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
nmcli>
nmcli> verify
Verify connection: OK
nmcli> save
Connection 'bond0' (1a75769d-b348-4ac8-a438-ec8f0e9a634e) successfully updated.
nmcli> quit

 アクティブスタンバイ構成なので、s8はONBOOT=yesに変更する。(s3はいじらない)

# cp -ipr --parents /etc/sysconfig/network-scripts/ifcfg-bond-slave-enp0s8 /var/tmp/infrawork/bkup/
# cp -ipr --parents /etc/sysconfig/network-scripts/ifcfg-bond0 /var/tmp/infrawork/bkup/
# sed -i -e 's/ONBOOT=no/ONBOOT=yes/' /etc/sysconfig/network-scripts/ifcfg-bond-slave-enp0s8
# sed -i -e 's/ONBOOT=no/ONBOOT=yes/' /etc/sysconfig/network-scripts/ifcfg-bond0
# nmcli c m enp0s8 connection.autoconnect no
# systemctl restart NetworkManager.service ; nmcli c up bond-slave-enp0s8
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)

# nmcli connection add type bond-slave ifname enp0s3 master bond0
Connection 'bond-slave-enp0s3' (0b5d165d-8695-4070-8426-8d40d0084968) successfully added.
# nmcli c
NAME               UUID                                  TYPE            DEVICE
bond0              1a75769d-b348-4ac8-a438-ec8f0e9a634e  bond            bond0
bond-slave-enp0s8  8e8852bf-f180-4f34-98f0-09731e9600bd  802-3-ethernet  enp0s8
enp0s3             995d3887-9fd0-4596-9e78-cbf2d25d7449  802-3-ethernet  enp0s3
bond-slave-enp0s3  0b5d165d-8695-4070-8426-8d40d0084968  802-3-ethernet  --
enp0s8             6d2589d4-2fd4-40bd-929e-2681b45ebc4b  802-3-ethernet  --

# cat /proc/net/bonding/bond0
MII Status: down
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: enp0s8
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: enp0s8
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 08:00:27:cf:f3:c4
Slave queue ID: 0

# init 6

 と、ここまで書いたところで噂が聞こえてきたのだが、RHEL7系からはインストール時にボンディング設定ができるとかなんとか……。まじかー。

 また、これとは別に、/etc/sysconfig/networkにHOSTNAME=hogeしても、ホスト名は変わらなかったりと、いろいろ厄介そうだ。