Sunday, 26 August 2012


Combining multiple network interface into single interface (bond)


Bonding is a process of combining more multiple network interfaces as one interface. The main objective of bonding is to improve the performance of both network interface. Using this way, more load and data can be handled by the bonded network interface rather than using single network interface. In this how to, I will use only two interfaces as example.

1. Create bond configuration file (example bond0)
# vim /etc/sysconfig/network-scripts/ifcfg-bond0

2. Put below configuration inside the bond0 configuration file
DEVICE=bond0
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
Replace above ip address, network and netmask with actual details and save the configuration file
3. Open the first network interface configuration file
# vim /etc/sysconfig/network-scripts/ifcfg-eth0
4. Append with the below details and save
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
5. Open the second network interface configuration file
# vim /etc/sysconfig/network-scripts/ifcfg-eth1
6. Edit the file to become like below and save
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
7. Load bond module
# vim /etc/modprobe.conf

8. Append below details and save
alias bond0 bonding
options bond0 mode=balance-alb miimon=100
9. Load the bonding module
# modprobe bonding
10. Restart network
# /etc/init.d/network restart
11. You can check whether your bonding is ok by using ifconfig command
# ifconfig
The output should be something like below
bond0     Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
RX packets:2804 errors:0 dropped:0 overruns:0 frame:0
TX packets:1879 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:250825 (244.9 KiB)  TX bytes:244683 (238.9 KiB)
eth0      Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
RX packets:2809 errors:0 dropped:0 overruns:0 frame:0
TX packets:1390 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:251161 (245.2 KiB)  TX bytes:180289 (176.0 KiB)
Interrupt:11 Base address:0x1400
eth1      Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:502 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:258 (258.0 b)  TX bytes:66516 (64.9 KiB)
Interrupt:10 Base address:0x1480

No comments:

Post a Comment