![]() |
Network Bonding |
There are almost six types of Channel Bond types are available. Here, we’ll review only two type ofChannel Bond which are popular and widely used.
Creating Ethernet Channel Bonding
TYPE=Ethernet
ONBOOT=”yes”
BOOTPROTO=”none”
USERCTL=no
MASTER=bond0
SLAVE=yes
TYPE=”Ethernet”
ONBOOT=”yes”
USERCTL=no
#NM_CONTROLLED=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
ONBOOT=yes
IPADDR=192.168.246.130
NETMASK=255.255.255.0
BONDING_OPTS=”mode=0 miimon=100″
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)
eth1 Link encap:Ethernet HWaddr 00:0C:29:57:61:8E
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:16989 errors:0 dropped:0 overruns:0 frame:0
TX packets:8072 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1196931 (1.1 MiB) TX bytes:819042 (799.8 KiB)
Interrupt:19 Base address:0x2000
eth2 Link encap:Ethernet HWaddr 00:0C:29:57:61:8E
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:385 errors:0 dropped:0 overruns:0 frame:0
TX packets:7989 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:34624 (33.8 KiB) TX bytes:803583 (784.7 KiB)
Interrupt:19 Base address:0x2080
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:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: [ OK ]
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2014)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth1
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 2
Permanent HW addr: 00:0c:29:57:61:8e
Slave queue ID: 0
Slave Interface: eth2
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 2
Permanent HW addr: 00:0c:29:57:61:98
Slave queue ID: 0
IPADDR=192.168.246.130
NETMASK=255.255.255.0
BONDING_OPTS=”mode=1 miimon=100″
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: [ OK ]
Ethernet Channel Bonding Driver: v3.6.0 (September 2
6, 2009)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth1
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 00:0c:29:57:61:8e
Slave queue ID: 0
Slave Interface: eth2
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 00:0c:29:57:61:98
Slave queue ID: 0
ANOTHER WAY TO CREATING BONDING AND TEAMING
All the system admin would like to avoid server outage by having redundancy for root file system using mirroring, Multiple FC links to SAN with help of multi-pathing and many more. So here the question is how do you provide redundancy in network level? Having a multiple network card will not give any redundancy. In red hat Linux you need to configure bonding to accomplish the network level redundancy. Once you have configured the bonding/teaming by using two NIC cards, kernel will automatically detect the failure of any NIC and work smartly according to that without any riot. Bonding can be used for load sharing as well between two physical links.
The below diagram will explain how the bonding is happening.
Operating system used: Redhat Linux 6.3
NIC Details:
[root@mylinz2 network-scripts]# ifconfig -a |grep eth
eth2 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
eth4 Link encap:Ethernet HWaddr 00:0C:29:79:17:04
eth3 Link encap:Ethernet HWaddr 00:0C:29:79:17:F0
[root@mylinz2 network-scripts]#
Goal:
Configure bonding between eth2 and eth4 with name of bond0.
![]() |
Bonding between eth2 & eth4 |
Add the below line in /etc/modprobe.conf to load the bonding module in to kernel.
alias bond0 bonding
In redhat 6.3 , you need to create new file called “bonding.conf” under /etc/modprobe.d/ with below mentioned line.
# cat /etc/modprobe.d/bonding.conf
alias bond0 bonding
Now time to create a bonding interface configuration file in /etc/sysconfig/network-scripts/ directory like the below one.
[root@mylinz2 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@mylinz2 network-scripts]# cat ifcfg-bond0
#This is congiguration file for bond0.Used NIC’s eth2 & eth4
DEVICE=bond0
IPADDR=192.168.10.25
NETMASK=255.255.255.0
USRCTL=no
ONBOOT=yes
BOOTPRO=none
BONDING_OPTS=”mode=0 miimon=100″
[root@mylinz2 network-scripts]#
Create a configuration files under “/etc/sysconfig/network-scripts/” for network interfaces if not exists.If exists,have a contents like the below one.
[root@mylinz2 network-scripts]# cat ifcfg-eth2
DEVICE=eth2
HWADDR=00:0C:29:79:17:FA
BOOTPRO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
[root@mylinz2 network-scripts]# cat ifcfg-eth4
DEVICE=eth4
HWADDR=00:0C:29:79:17:04
BOOTPRO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
Now restart the network service to load the configuration.
Note:Do not restart the network service without server maintenance window.
[root@mylinz2 ~]# service network restart
Shutting down interface eth2: Device state: 3 (disconnected) [ OK ]
Shutting down interface eth4: Device state: 3 (disconnected) [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/15
[ OK ]
Bringing up interface eth3: Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/16
[ OK ]
[root@mylinz2 ~]#
Verify whether “bond0″ has come up with IP or not .
[root@mylinz2 Desktop]# ifconfig -a
bond0 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
inet addr:192.168.10.25 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe79:17fa/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:22 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3843 (3.7 KiB) TX bytes:4169 (4.0 KiB)
eth2 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2031 (1.9 KiB) TX bytes:2064 (2.0 KiB)
eth4 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1812 (1.7 KiB) TX bytes:2105 (2.0 KiB)
Performing the live test to ensure bonding is providing the fault tolerance.
First i am removing the LAN cable from eth4 and let see what happens.
[root@mylinz2 Desktop]# ifconfig -a
bond0 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
inet addr:192.168.10.25 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe79:17fa/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:22 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3843 (3.7 KiB) TX bytes:4169 (4.0 KiB)
eth2 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2031 (1.9 KiB) TX bytes:2064 (2.0 KiB)
eth4 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
UP BROADCAST SLAVE MULTICAST MTU:1500 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1812 (1.7 KiB) TX bytes:2105 (2.0 KiB)
Still the bond0 interface is UP and RUNNING fine.At the same time,”RUNNING” flag has disappear from eth4.
Now i have connected LAN cable back to eth4 and pulling out from eth2.
[root@mylinz2 Desktop]# ifconfig -a
bond0 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
inet addr:192.168.10.25 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe79:17fa/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:22 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3843 (3.7 KiB) TX bytes:4169 (4.0 KiB)
eth2 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
UP BROADCAST SLAVE MULTICAST MTU:1500 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2031 (1.9 KiB) TX bytes:2064 (2.0 KiB)
eth4 Link encap:Ethernet HWaddr 00:0C:29:79:17:FA
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1812 (1.7 KiB) TX bytes:2105 (2.0 KiB)
Still “bond0″ interface running with UP & RUNNING flag.So you have successfully configured bonding on Redhat Linux 6.
To see complete bonding info,use below command.
[root@mylinz2 Desktop]# 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: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:79:17:fa
Slave queue ID: 0
Slave Interface: eth4
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:79:17:04
Slave queue ID: 0
[root@mylinz2 Desktop]#
To verify the current bonding mode,use below command.
[root@mylinz2 Desktop]# cat /sys/class/net/bond0/bonding/mode
balance-rr 0
You can modify the bonding mode by editing “mode” in the ifcfg-bond0 configuration file.
[root@mylinz2 Desktop]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 |grep -i mode
BONDING_OPTS=”mode=0 miimon=100″
table.tableizer-table { border: 1px solid #CCC; font-family: ; font-size: 12px; } .tableizer-table td { padding: 4px; margin: 3px; border: 1px solid #ccc; } .tableizer-table th { background-color: #104E8B; color: #FFF; font-weight: bold; }
Policy Details
|
||
Ploicy Name | Code | Description |
balance-rr | 0 | Round-Robin policy for fault tolerance |
active-backup | 1 | Active-Backup policy for fault tolerance |
balance-xor | 2 | Exclusive-OR policy for fault tolerance |
broadcast | 3 | All transmissions are sent on all slave interfaces. |
802.3ad | 4 | Dynamic link aggregation policy |
balance-tlb | 5 | Transmit Load Balancing policy for fault tolerance |
balance-alb | 6 | Active Load Balancing policy for fault tolerance |
To list the currently configured bonds,
[root@mylinz2 Desktop]# cat /sys/class/net/bonding_masters
bond0