Below are steps on how to configure.
1 – Operating modules:
2 – Loading the module:
modprobe --first-time bonding
modprobe bonding
ShellScript3 – To list the bonding module info, use following command:
modinfo bonding
ShellScript4 – In my example, I am setting up active-backup mode (mode=1 active-backup) in bond0 master:
cat >> /etc/sysconfig/network-scripts/ifcfg-bond0 << EOF
DEVICE=bond0
NAME=bond0
TYPE=Bond
BONDING_MASTER=yes
IPADDR=10.6.253.16
PREFIX=16
GATEWAY=10.6.254.254
DNS1=8.8.8.8
ONBOOT=yes
BOOTPROTO=none
BONDING_OPTS="mode=1 miimon=100"
EOF
ShellScript5 – Configuring slave ifcfg-eno1 interface pointing to bond0:
[root@srvdb network-scripts]# cat ifcfg-eno1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno1
UUID=1da7ea19-7191-4977-a3de-0c4d563a007f
DEVICE=eno1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
ShellScript6 – Configuring slave ifcfg-eno2 interface pointing to bond0:
[root@srvdb network-scripts]# cat ifcfg-eno2
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno2
UUID=784999ab-8658-477c-9d57-a943b44d0936
DEVICE=eno2
ONBOOT=yes
MASTER=bond0
SLAVE=yes
ShellScript7 – Up bond0
nmcli con up bond0
ShellScript8 – Reload nmcli
nmcli con reload
ShellScript9 – Down and up eno2 and eno1 interface:
ifup eno1
ifup eno2
ShellScript10 – Restart network:
systemctl restart network
ShellScript11 – Information about the operation of bond0:
[root@srvdb network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup) <== mode=1 active-backup
Primary Slave: None
Currently Active Slave: eno1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eno1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 38:68:dd:32:98:58
Slave queue ID: 0
Slave Interface: eno2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 38:68:dd:32:98:59
Slave queue ID: 0
[root@srvdb network-scripts]#
ShellScript12 – All information about networks:
[root@srvdb network-scripts]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
2: eno1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP mode DEFAULT group default qlen 1000
3: eno2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP mode DEFAULT group default qlen 1000
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
ShellScript13 – Tests for operation:
Ping the bond ip 10.6.253.16
Down eno2 interface: ifdown eno2
Start eno2 interface: ifup eno2
Down eno1 interface: ifdown eno1
Start eno1 interface: ifup eno1
When one interface is disabled or the network goes down, the other interface will automatically take over.
If it falls eno1 to eno2 will take over, if it falls to eno2 eno1 will take over.
ShellScript