What is ?
Two or more than that network adapters in corporate with single logical network pipe.
Logical network interface work as master and physical network interfaces are work as slave.
IP Address is assigned to logical interface instead of assigning physical interfaces.
Logical interface only will work on connecting any internal/external network traffic.
It has several modes of operations based on behavior.
Modes:
- Round robin
- Active backup
- XOR
- Broadcast
Advantages:
- Better throughput
- Load balancing
- Fault tolerance
Issue ip a command to check available interfaces in server.
in my server, i have two insterfaces called enp0s3 and enp0s8
Using mobprobe command load the bonding kernel if its not loaded already.
[root@server ~]# modprobe bonding
To check whether the bonding driver in kernel use the modinfo command and that will list the details like below once its loaded.
[root@server ~]# modinfo bonding filename: /lib/modules/3.10.0-514.el7.x86_64/kernel/drivers/net/bonding/bonding.ko author: Thomas Davis, [email protected] and many others description: Ethernet Channel Bonding Driver, v3.7.1 version: 3.7.1 license: GPL alias: rtnl-link-bond rhelversion: 7.3 srcversion: B664145ACFBCC961505C750 depends: intree: Y vermagic: 3.10.0-514.el7.x86_64 SMP mod_unload modversions
Create a file called ifcfg-bond0 which will work as logical interface in bonding using vi editor with below mentioned settings under /etc/sysconfig/network-scripts
[root@server ~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 TYPE=Bond NAME=bond0 BONDING_MASTER=yes BOOTPROTO=none ONBOOT=yes IPADDR=192.168.43.250 NETMASK=255.255.255.0 GATEWAY=192.168.43.1 BONDING_OPTS="mode=5 miimon=100" ZONE=public :wq
save and exit from the file.
now the bond0 logical interface has been created and have to set the slave interface by following below steps.
in our case already we have two interfaces called enp0s3 and enp0s8. for the same configuration file also already there under /etc/sysconfig/network-scripts with below name’s
ifcfg-enp0s3
ifcfg-enp0s8
edit the above two files using vi editor and make entry for MASTER and SLAVE. Set the MASTER=bond0 and SLAVE=Yes for the both interface configuration files like below.
[root@server ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 TYPE=Ethernet NAME=enp0s3 UUID=f42b80f0-95dd-4126-a5f8-62db4f4a368f DEVICE=enp0s3 ONBOOT=yes MASTER=bond0 SLAVE=Yes
[root@server ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s8 TYPE=Ethernet NAME=enp0s8 DEVICE=enp0s8 UUID=f42b80f0-95dd-4126-a5f8-62db4f4a368f ONBOOT=yes MASTER=bond0 SLAVE=Yes
Now use ifdown and ifup command to bring down and bring up the bond0 interface.
[root@server ~]# ifdown bond0 ../network: line 2: NETWORKING: command not found Device 'bond0' successfully disconnected. [root@server ~]# ifup bond0 ../network: line 2: NETWORKING: command not found Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/16)
Then check the ip of bond0 to confirm whether our bonding has been working or not.
[root@server ~]# ip a | grep bond0 6: bond0: <NO-CARRIER,BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000 inet 192.168.43.250/24 brd 192.168.43.255 scope global bond0
We configured bonding successfully. Now will communicate from remote server to this server using bond0 interface ip address (192.168.43.250)
Thanks for your support 🙂