I tried to build bonding with two network interfaces on CentOS 7.3. I would like to output the procedure until bonding is assembled.
Bundle multiple network interfaces to make them redundant and improve processing capacity.
teaming
.item | Description |
---|---|
Hypervisor | ESXi6.7 |
OS | CentOS7.3 |
NIC | 2 sheets |
[root@tspweb01 ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@tspweb01 ~]#
Slave Physical interface to participate in Bonding
Master Logical interface that controls Bonding
** ① Network check **
--Network interface
Confirm that ʻens192 and ʻens224
are down.
[root@tspweb01 network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
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: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
3: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:0c:29:ee:2e:c4 brd ff:ff:ff:ff:ff:ff
--NetworkManager status
Confirm that the service is up
[root@tspweb01 network-scripts]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running)since fire 2020-06-16 20:11:06 JST; 17min ago
Docs: man:NetworkManager(8)
Main PID: 782 (NetworkManager)
CGroup: /system.slice/NetworkManager.service
mq782 /usr/sbin/NetworkManager --no-daemon
June 16 20:26:28 tspweb01 NetworkManager[782]: <info> [1592306788.2383] ma...L
June 16 20:26:28 tspweb01 NetworkManager[782]: <info> [1592306788.2384] po...S
June 16 20:26:28 tspweb01 NetworkManager[782]: <info> [1592306788.2386] po...S
June 16 20:26:33 tspweb01 NetworkManager[782]: <info> [1592306793.2854] de...]
June 16 20:26:33 tspweb01 NetworkManager[782]: <info> [1592306793.2855] ma...L
June 16 20:26:33 tspweb01 NetworkManager[782]: <info> [1592306793.2885] au..."
June 16 20:26:33 tspweb01 NetworkManager[782]: <info> [1592306793.2890] de...]
June 16 20:26:33 tspweb01 NetworkManager[782]: <info> [1592306793.2900] ma...L
June 16 20:26:33 tspweb01 NetworkManager[782]: <info> [1592306793.2901] po...S
June 16 20:26:33 tspweb01 NetworkManager[782]: <info> [1592306793.2902] po...S
Hint: Some lines were ellipsized, use -l to show in full.
[root@tspweb01 network-scripts]#
** ② Network setting file backup **
--ʻIfcfg-* `backup
mkdir -p /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`
cp -p /etc/sysconfig/network-scripts/ifcfg-* /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`/.
ls -la /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`
Execution example
[root@tspweb01 network-scripts]# mkdir -p /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`
[root@tspweb01 network-scripts]# cp -pi /etc/sysconfig/network-scripts/ifcfg-* /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`/.
[root@tspweb01 network-scripts]#
[root@tspweb01 network-scripts]# ls -la /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`
20 in total
drwxr-xr-x.2 root root 82 June 16 21:00 .
drwxr-xr-x.3 root root 4096 June 16 20:59 ..
-rw-r--r--.1 root root 153 June 16 20:25 ifcfg-ens192
-rw-r--r--.1 root root 153 June 12 07:54 ifcfg-ens224
-rw-r--r--.1 root root 254 September 12 2016 ifcfg-lo
[root@tspweb01 network-scripts]#
** ③ bonding.conf backup **
--Check for the existence of bonding.conf
Make sure that bonding.conf
does not exist.
[root@tspweb01 network-scripts]# ls -l /etc/modprobe.d/bonding.conf;date
ls: /etc/modprobe.d/bonding.Unable to access conf:There is no such file or directory
Tuesday, June 16, 2020 20:30:30 JST
[root@tspweb01 network-scripts]#
cp -p /etc/modprobe.d/bonding.conf /etc/modprobe.d/bonding.conf_`date +'%Y%m%d'`
ls -la /etc/modprobe.d/bonding.conf_`date +'%Y%m%d'`
** ① Create and check bonding.conf **
--Create bonding.conf
vi /etc/modprobe.d/bonding.conf
Settings
alias bond0 bonding
After setting, save with wq!
.
--bonding.conf
Check the contents
It must be the set content.
[root@tspweb01 modprobe.d]# cat /etc/modprobe.d/bonding.conf
alias bond0 bonding
[root@tspweb01 modprobe.d]#
** ② NIC setting **
vi /etc/sysconfig/network-scripts/ifcfg-ens192
Contents
TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NAME=ens192
HWADDR=00:0c:29:ee:2e:ba
DEVICE=ens192
ONBOOT=yes
MASTER=bond0
SLAVE=yes
vi /etc/sysconfig/network-scripts/ifcfg-ens224
Contents
TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NAME=ens224
HWADDR=00:0c:29:ee:2e:c4
DEVICE=ens224
ONBOOT=yes
MASTER=bond0
SLAVE=yes
** [Explanation of settings] **
item | Description |
---|---|
TYPE | type |
BOOTPROTO | When using DHCP"dhcp", If you want to set it statically"static"Or"none" |
IPV6INIT | Whether IPv6 setting is implemented |
NAME | NIC name |
HWADDR | MAC address of NIC |
DEVICE | NIC device name |
ONBOOT | Whether to boot the NIC when the OS boots |
MASTER | Logical interface name to set(This timebond0 ) |
SLAVE | Whether to use as SLAVE |
** ③ NIC setting check **
[root@tspweb01 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-ens192
TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NAME=ens192
HWADDR=00:0c:29:ee:2e:ba
DEVICE=ens192
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@tspweb01 network-scripts]#
[root@tspweb01 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-ens224
TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NAME=ens224
HWADDR=00:0c:29:ee:2e:c4
DEVICE=ens224
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@tspweb01 network-scripts]#
** ④ bonding setting **
vi /etc/sysconfig/network-scripts/ifcfg-bond0
Contents
BOOTPROTO=none
DEVICE=bond0
TYPE=Bond
ONBOOT=yes
IPADDR=192.168.0.41
PREFIX=24
GATEWAY=192.168.0.1
BONDING_OPTS="mode=1 miimon=100 primary=ens192 primary_reselect=1"
** [BONDING_OPTS description] **
BONDING_OPTS="mode=1 miimon=100"
item | Set value | Description |
---|---|---|
mode | 1 | Active-backup mode |
miimon | 100 | 0.Check the Bonding status at 1-second intervals(1000msec =1 second) |
** ⑤ Bonding setting confirmation **
[root@tspweb01 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
BOOTPROTO=none
DEVICE=bond0
TYPE=Bond
ONBOOT=yes
IPADDR=192.168.0.41
PREFIX=24
GATEWAY=192.168.0.1
BONDING_OPTS="mode=1 miimon=100 primary=ens192 primary_reselect=1"
[root@tspweb01 network-scripts]#
** ⑥ network service restart **
systemctl restart network
** ① Check IP information **
Confirm that bond0
exists.
[root@tspweb01 network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
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: ens192: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000
link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
3: ens224: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000
link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
4: ens256: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:0c:29:ee:2e:ce brd ff:ff:ff:ff:ff:ff
inet 192.168.0.45/24 brd 192.168.0.255 scope global ens256
valid_lft forever preferred_lft forever
inet6 2404:7a80:91a1:4d00:20c:29ff:feee:2ece/64 scope global tentative mngtmpaddr dynamic
valid_lft 2592000sec preferred_lft 604800sec
inet6 fe80::20c:29ff:feee:2ece/64 scope link tentative
valid_lft forever preferred_lft forever
7: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
inet 192.168.0.41/24 brd 192.168.0.255 scope global bond0
valid_lft forever preferred_lft forever
inet6 2404:7a80:91a1:4d00:20c:29ff:feee:2eba/64 scope global tentative mngtmpaddr dynamic
valid_lft 2592000sec preferred_lft 604800sec
inet6 fe80::20c:29ff:feee:2eba/64 scope link
valid_lft forever preferred_lft forever
[root@tspweb01 network-scripts]#
** ② Bonding status check **
Bonding is made up of ʻens192 and ʻens224
.
[root@tspweb01 network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: ens192 (primary_reselect better)
Currently Active Slave: ens192
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens192
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:ee:2e:ba
Slave queue ID: 0
Slave Interface: ens224
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:ee:2e:c4
Slave queue ID: 0
[root@tspweb01 network-scripts]#
** ③ SSH confirmation at TeraTerm **
What you can ssh.
① Drop ʻens192`
[root@tspweb01 ~]# ifdown ens192
device'ens192'Was successfully disconnected.
[root@tspweb01 ~]#
③ Confirm that it has been switched to ʻens224`
[root@tspweb01 ~]# 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: ens224
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens224
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:ee:2e:c4
Slave queue ID: 0
[root@tspweb01 ~]#
What is bonding [What is Bonding? --IT Glossary e-Words](http://e-words.jp/w/%E3%83%9C%E3%83%B3%E3%83%87%E3%82%A3% E3% 83% B3% E3% 82% B0.html) [Linux (CentOS8 / RHEL8) Bonding mode and setting confirmation method, combination with Switch Link Aggregation setting](https://milestone-of-se.nesuke.com/nw-basic/link-aggregation/linux- bonding-and-switch-config /) Bonding on CentOS 7
Recommended Posts