RHEL: Linux Bond / Multiple Network Interfaces (NIC) Into a Single Interface
Bonding is nothing but Linux kernel feature that allows to aggregate multiple like interfaces (such as eth0, eth1) into a single virtual link such as bond0. The idea is pretty simple get higher data rates and as well as link failover.
We will configure here bond0 virtual link on eth0 and eth1 NIC Cards on RHEL5.8 Server. It will also work on latest RHEL 6 version.
Bonding is mainly kernel feature of RHEL server which provides this functionality of load balancing and redundancy of link. The Bonding driver should be installed on server before configuring multiple NIC cards into a single bond virtual link.
Step #1: Create a Bond0 Configuration File
Red Hat Enterprise Linux (and its clone such as Cent OS) stores network configuration in /etc/sysconfig/network-scripts/ directory. First, you need to create a bond0 configuration file as follows:
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
Append the following lines:
Append the following lines:
DEVICE=bond0
IPADDR=10.0.1.67
NETWORK=10.0.0.0
NETMASK=255.255.252.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
You need to replace IP address with your actual setup. Save and close the file.
Step #2: Modify eth0 and eth1 config files
Open both configuration using a text editor such as vi/vim, and make sure file read as follows for eth0 interface# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Modify/append directive as follows:
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
Make sure file read as follows for eth1 interface:
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
Save and close the file.
Step # 3: Load bond driver/module
Make sure bonding module is loaded when the channel-bonding interface (bond0) is brought up. You need to modify kernel modules configuration file:
# vi /etc/modprobe.conf
Append following two lines:
alias bond0 bonding
options bond0 mode=balance-alb miimon=100
Save file and exit to shell prompt.
Step # 4: Test configuration
First, load the bonding module, enter:# modprobe bonding
Restart the networking service in order to bring up bond0 interface, enter:
Make sure everything is working. Type the following cat command to query the current status of Linux kernel bounding driver, enter:
# service network restart
Make sure everything is working. Type the following cat command to query the current status of Linux kernel bounding driver, enter:
#
cat /proc/net/bonding/bond0
Bonding Mode: adaptive load balancing
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: eth0
MII Status: down
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 10:1f:74:2f:8c:8c
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
To list all network interfaces, Enter:
# ifconfig
Sample outputs:
bond0 Link encap:Ethernet HWaddr 10:1F:74:2F:8C:8C
inet addr:10.0.1.67 Bcast:10.0.15.255 Mask:255.255.240.0
inet6 addr: 2002:dc9c:bfcf:5:121f:74ff:fe2f:8c8c/64 Scope:Global
inet6 addr: fec0::5:121f:74ff:fe2f:8c8c/64 Scope:Site
inet6 addr: fec0::a:121f:74ff:fe2f:8c8c/64 Scope:Site
inet6 addr: 2002:dc9c:bfca:a:121f:74ff:fe2f:8c8c/64 Scope:Global
inet6 addr: fe80::121f:74ff:fe2f:8c8c/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:4123683 errors:0 dropped:0 overruns:0 frame:0
TX packets:1658279 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2050975191 (1.9 GiB) TX bytes:555880972 (530.1 MiB)
eth0 Link encap:Ethernet HWaddr 10:1F:74:2F:8C:8E
UP BROADCAST SLAVE MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:162 Memory:f4000000-f4012800
eth1 Link encap:Ethernet HWaddr 10:1F:74:2F:8C:8C
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:4123683 errors:0 dropped:0 overruns:0 frame:0
TX packets:1658279 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2050975191 (1.9 GiB) TX bytes:555880972 (530.1 MiB)
Interrupt:170 Memory:f2000000-f2012800
__________________________________________________________________________________
good articles, keep writing.
ReplyDeleteAnd if want taxi reach us at 99999-47-121 taxiclub.in