A network interface bond is a Linux kernel feature that enables two or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy.
Overall creating the bond is not more than configuring a few files and loading the module using modprobe so everyone can do it.
Create the New Configuration File
Create a file in the following path called ifcfg-bond0. This file will be the configuration file of the bond:
[root@devops ~]vi /etc/sysconfig/network-scripts/ifcfg-bond0
The bond file will be a lot similar to a regular interface configuration file. The IP address mentioned in the file will be your current IP address and also the subnet mask. The file should look as follow:
DEVICE=bond0 IPADDR=126.96.36.199 NETMASK=255.255.255.0 BOOTPROTO=none ONBOOT=yes
Of course you can add the rest of the lines you had in your original interface file. These are just the basic options.
Modify the Network Interfaces Configuration Files
Modify the configuration file of the interfaces you want in your bond.
[root@devops ~]vi /etc/sysconfig/network-scripts/ifcfg-eth0
The file should look as follows:
DEVICE=eth0 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes
Edit the second interface file. open the file of eth1:
[root@devops ~]vi /etc/sysconfig/network-scripts/ifcfg-eth1
This file will look almost the same as the previous file:
DEVICE=eth1 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes
Load the Bonding Module
Edit the file /etc/modprobe.conf
[root@devops ~]vi /etc/modprobe.conf
Append the following line:
alias bond0 bonding
Now in order to load the module, enter the following command:
Warning! This part will shutdown the network to your server so make sure you can access your server from console. (if this is a problem for you I believe a simple reboot will also do the trick.)
Enter the following commands:
[root@devops ~]ifdown eth0 [root@devops ~]ifdown eth1 [root@devops ~]service network restart
and that’s it ! you should see your bond using[root@devops ~]ifconfig
bond0 Link encap:Ethernet HWaddr 00:0C:29:57:61:8E inet addr:192.168.246.130 Bcast:192.168.246.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe57:618e/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:17374 errors:0 dropped:0 overruns:0 frame:0 TX packets:16060 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1231555 (1.1 MiB) TX bytes:1622391 (1.5 MiB)