Network bonding is aggregation of multiple network interfaces to single interface for load balancing, high availability, fault tolerance etc., This can be achieved by using the kernel module bonding. By default this will not loaded which we need to load this module manually while doing the configuration.

I have created the bonding by using 2 interfaces eth0 & eth1. We will see how to configure network bonding from the below examples.

STEP 1:

First we need to create a bond0 interface as shown below. Replace the Ip with your IP.

[root@rhel6-1 ~]# vim /etc/sysconfig/network-scripts/ifcfg-bond0
[root@rhel6-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.100.20
NETWORK=192.168.100.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
[root@rhel6-1 ~]# 

STEP 2:

Take the backup of existing eth0 interface config file. It might be useful to revert back to old config if needed.

Then modify your eth0 and eth1 as shown below. You can remove existing content and replace with below.


[root@rhel6-1 ~]# cd /etc/sysconfig/network-scripts/
[root@rhel6-1 network-scripts]# cp ifcfg-eth0 bk_ifcfg_eth0
[root@rhel6-1 network-scripts]# vim ifcfg-eth0
[root@rhel6-1 network-scripts]# cat ifcfg-eth0 
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
[root@rhel6-1 network-scripts]#

STEP 3:

Create the modprobe.conf which will not exists by default and append below mentioned 2 lines

[root@rhel6-1 modprobe.d]# vim /etc/modprobe.d/modprobe.conf 
[root@rhel6-1 modprobe.d]# cat /etc/modprobe.d/modprobe.conf 
alias bond0 bonding
options bond0 mode=balance-alb miimon=100
[root@rhel6-1 modprobe.d]# 

STEP 4:

Load the kernel module bonding and restart the network services

[root@rhel6-1 modprobe.d]# service network restart
Shutting down interface bond0:                             [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface bond0:  Determining if ip address 192.168.100.11 is already in use for device bond0...
                                                           [  OK  ]
[root@rhel6-1 modprobe.d]# 

STEP 5 :

Execute ifconfig command to check both eth0 & eth1 interfaces are up and no Ip assigned to it and Ip assigned to bond0 interface.

[root@rhel6-1 modprobe.d]# ifconfig
bond0     Link encap:Ethernet  HWaddr 52:54:00:C0:7D:EF  
          inet addr:192.168.100.11  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fec0:7def/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:5009 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1455 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:361419 (352.9 KiB)  TX bytes:289285 (282.5 KiB)

eth0      Link encap:Ethernet  HWaddr 52:54:00:C0:7D:EF  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:3723 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1446 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:293839 (286.9 KiB)  TX bytes:287775 (281.0 KiB)

eth1      Link encap:Ethernet  HWaddr 52:54:00:C0:7D:EF  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:1286 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:67580 (65.9 KiB)  TX bytes:1628 (1.5 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:344 (344.0 b)  TX bytes:344 (344.0 b)

[root@rhel6-1 modprobe.d]# 

STEP 6 :

File /proc/net/bonding/bond0 also not exists by default, it will be created automatically and this shows the bonding mode and the status of interfaces

[root@rhel6-1 modprobe.d]# cat /proc/net/bonding/bond0 
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 52:54:00:c0:7d:ef
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 52:54:00:3e:57:b4
Slave queue ID: 0
[root@rhel6-1 modprobe.d]# 

NO COMMENTS

LEAVE A REPLY