Bonding is nothing but combining two or more network interfaces to create a one logical bonded interface which provides the redundancy and load balance which increase the bandwidth. Depends on the mode the bonded interface perform or work. Let we see the configuration method of bonding in LINUX.
1. Confirm the Mode of bonding.
2. Check Integrity and functionality of each NIC.
3. Check Interface kernel Module
4. Add the bonding entry on /etc/modprobe.conf and update the module
5. Edit the Interface configuration file to point the Bonding Logical interface.
6. Restart the network services.
From the below example we are going to create Logical interface bonding between network eth0 and eth1.
Later on we can do for the same for other interfaces (eth2, eth3)
Bonding Modes
Mode | code | Policies |
---|---|---|
Balance-rr | 0 | Round-robin policy for fault tolerance and load balancing. |
Active-backup | 1 | Active-backup policy for fault tolerance. |
Balance-xor | 2 | XOR (exclusive-or) policy for fault tolerance and load balancing. |
Broadcast | 3 | Broadcast policy for fault tolerance. |
802.3ad | 4 | IEEE 802.3ad dynamic link aggregation policy. Requires a switch that is 802.3ad compliant. |
balance-tlb | 5 | Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. |
balance-alb | 6 | Active Load Balancing (ALB) policy for fault tolerance and load balancing. |
Check Integrity and functionality of each NIC.
[root@unixrock ~]# ethtool eth0 Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on MDI-X: Unknown Supports Wake-on: d Wake-on: d Current message level: 0x00000007 (7) Link detected: yes [root@unixrock ~]#
[root@unixrock ~]# ethtool eth1 Settings for eth1: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on MDI-X: Unknown Supports Wake-on: d Wake-on: d Current message level: 0x00000007 (7) Link detected: yes [root@unixrock ~]#
From the above output we need to check the interface "Speed", "Duplex" and "Link Detected" status and we found all values are same. Now the interface ready for the configurations.
Checking kernel Modules
[root@unixrock ~]# modprobe --list |egrep -i "bonding|mii" kernel/drivers/net/mii.ko kernel/drivers/net/bonding/bonding.ko [root@unixrock ~]#
[root@unixrock ~]# cat >/etc/modprobe.d/bonding.conf alias bond0 bonding [root@unixrock ~]# cat /etc/modprobe.d/bonding.conf alias bond0 bonding [root@unixrock ~]#
[root@unixrock ~]# modprobe bonding [root@unixrock ~]#Now all modules are loaded and ready for the configuration of each NIC.
First configuring interface eth0
[root@unixrock ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE="eth0" BOOTPROTO="none" ONBOOT="yes" MASTER="bond0" SLAVE="yes" USERCTL="no" NM_CONTROLLED="no" TYPE="ethernet" [root@unixrock ~]#Configuring other interface eth1
[root@unixrock ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE="eth1" BOOTPROTO="none" ONBOOT="yes" MASTER="bond0" SLAVE="yes" USERCTL="no" NM_CONTROLLED="no" TYPE="ethernet" [root@unixrock ~]#Configuring of bond0
[root@unixrock ~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE="bond0" BOOTPROTO="none" ONBOOT="yes" NETMASK="255.255.255.0" IPADDR="192.168.10.20" USERCTL="no" BONDING_OPTS="mode=0 miimon=100" NM_CONTROLLED="no" [root@unixrock ~]#mode Bonding mode (Balance-rr or 0).
miimon Value for the frequency (in ms) of MII link monitoring.
Now we have completed our configuration of network bonding.
NOTE : If your changing the current interface configuration,recommended to do it on server console. Now we are ready for restart the Network service.
[root@unixrock ~]# service network restart Shutting down interface bond0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface bond0: [ OK ] [root@unixrock ~]#After configuring "ifconfig" command output shown as below
[root@unixrock ~]# ifconfig -a bond0 Link encap:Ethernet HWaddr 00:0C:29:2B:BD:A8 inet addr:192.168.10.20 Bcast:192.168.10.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe2b:bda8/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:9452 errors:0 dropped:0 overruns:0 frame:0 TX packets:7702 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2773700 (2.6 MiB) TX bytes:753255 (735.6 KiB) eth0 Link encap:Ethernet HWaddr 00:0C:29:2B:BD:A8 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:8659 errors:0 dropped:0 overruns:0 frame:0 TX packets:3874 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2692648 (2.5 MiB) TX bytes:381126 (372.1 KiB) eth1 Link encap:Ethernet HWaddr 00:0C:29:2B:BD:A8 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:793 errors:0 dropped:0 overruns:0 frame:0 TX packets:3829 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:81052 (79.1 KiB) TX bytes:372363 (363.6 KiB) [root@unixrock ~]#Checking the bonding interface details
[root@unixrock ~]# ls -ltr /proc/net/bonding/bond0 -r--r--r--. 1 root root 0 Feb 10 11:00 /proc/net/bonding/bond0 [root@unixrock ~]# 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): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth0 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:0c:29:2b:bd:a8 Slave queue ID: 0 Slave Interface: eth1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:0c:29:2b:bd:b2 Slave queue ID: 0 [root@unixrock ~]#
No comments:
Post a Comment