Network Interface Card (NIC) bonding, also known as
link aggregation,
NIC teaming and
trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator can ensure their machine will continue to be accessible in the event of a NIC failure, cable disconnection or other issue with one of the NICs.
If you run Linux servers, you can configure your Operating System to use multiple NICs in a team using the procedure below.
- 1
Create a bond0 configuration file
Red Hat Linux stores network configuration in the /etc/sysconfig/network-scripts/ directory. First, you need to create bond0 config file:
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
Append following lines to it:
DEVICE=bond0
IPADDR=192.168.1.11
NETWORK=192.168.1.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
1:
2:
3:
4:
5:
6:
7:
Select allOpen in new window
Replace the above IP address with your actual IP address. Save the file and exit to shell prompt.
- 2
Modify eth0 and eth1 config files
Open both configuration using vi text editor and make sure file read as follows for eth0 interface
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Modify/append directive as follows:
Open eth1 configuration file using vi text editor:
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
Make sure file read as follows for eth1 interface:
Save file and exit to shell prompt.
- 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:
Save file and exit to shell prompt.
- 4
Test configuration
First, load the bonding module:
# modprobe bonding
Restart networking service in order to bring up bond0 interface:
# service network restart
List all interfaces:
# ifconfig
Output:
bond0 Link encap:Ethernet HWaddr 00:0C:29:82:0F:46
inet addr:192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe82:f46/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2313 errors:0 dropped:0 overruns:0 frame:0
TX packets:2372 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1591448 (1.5 MiB) TX bytes:806958 (788.0 KiB)
eth0 Link encap:Ethernet HWaddr 00:0C:29:82:0F:46
inet6 addr: fe80::20c:29ff:fe82:f46/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:2187 errors:0 dropped:0 overruns:0 frame:0
TX packets:1826 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1564864 (1.4 MiB) TX bytes:583939 (570.2 KiB)
Interrupt:185 Base address:0×1400
eth1 Link encap:Ethernet HWaddr 00:0C:29:82:0F:46
inet6 addr: fe80::20c:29ff:fe82:f46/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:126 errors:0 dropped:0 overruns:0 frame:0
TX packets:546 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26584 (25.9 KiB) TX bytes:223019 (217.7 KiB)
Interrupt:169 Base address:0×1480
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
Select allOpen in new window
As you can see, we now have one ip for both NICs in the form of bond0. If u want to test this method and ensure it will work when a NIC fails or is disconnected, simply use this command to shutdown one NIC - simulating a NIC failure.
#ifconfig eth1 down
Then, ping the IP given to the bond. You should receive a reply to your ping even after shutting down the second NIC. This is what redundancy is all about!
by: acl-puzz on 2010-04-08 at 22:47:19ID: 12810
lol this not my site and i never ever went to that cant prove that though!!
do whatever you think appropriate......... enough said!