Bond NICs in Linux

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Step #1: Create a bond0 configuration file

Red Hat Linux stores network configuration in /etc/sysconfig/network-scripts/ directory. First, you need to create bond0 config file and add following lines to it:

DEVICE=bond0
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes

Step #2: Modify eth0 and eth1 config files:

Open configuration file(/etc/sysconfig/network-scripts/ifcfg-eth0) make sure file read as follows for eth0 interface

DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

Open eth1 configuration file (/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

Step # 3: Load bond driver/module

NOTE>>>For FC less then 11

Make sure bonding module is loaded when the channel-bonding interface (bond0) is brought up. You need to modify kernel modules configuration file /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:

modprobe bonding

Restart networking service in order to bring up bond0 interface:

service network restart

Verify everything is working:

less /proc/net/bonding/bond0

You should see the following:

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
Link Failure Count: 0
Permanent HW addr: 00:0c:29:c6:be:59

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:c6:be:63

List all interfaces:

ifconfig

You are looking for bond0, Eth0 and Eth1:

bond0     Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2804 errors:0 dropped:0 overruns:0 frame:0
TX packets:1879 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:250825 (244.9 KiB) TX bytes:244683 (238.9 KiB)

eth0 Link encap:Ethernet HWaddr 00:0C:29:C6:BE:59
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:2809 errors:0 dropped:0 overruns:0 frame:0
TX packets:1390 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:251161 (245.2 KiB) TX bytes:180289 (176.0 KiB)
Interrupt:11 Base address:0x1400

eth1 Link encap:Ethernet HWaddr 00:0C:29:C6:BE:59
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:502 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:258 (258.0 b) TX bytes:66516 (64.9 KiB)
Interrupt:10 Base address:0x1480

Step # 5: Some issues I had

The first issue was that I had no outgoing internet access once my NICs were bonded. I could get to the server just fine, but it couldnt get out.

I did a route command and got this:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Ifacelink-local * 255.255.0.0 U 1004 0 0
bond010.95.0.0 * 255.255.0.0 U 0 0 0
bond010.95.0.0 * 255.255.0.0 U 1 0 0
eth010.95.0.0 * 255.255.0.0 U 1 0 0
eth1default 10.95.1.1 0.0.0.0 UG 0 0 0 eth1

The problem was that my default gatway was bound to eth1 and not bond0. Open the config files for eth0 and eth1 and remove any GATEWAY settings. Open the bond0 config file and add GATEWAY=192.168.1.1 and save the file.

Restart networking service in order to bring up bond0 interface:

service network restart

The second issue was DNS. Once I moved the gateway I had internet access, but I could not resolve names. Again the issue was that DNS was in eth1 and not in bond0. Open the bond0 config file and add DNS1=192.168.1.1 and save the file

Restart networking service in order to bring up bond0 interface:

service network restart


That's it. You now have bonded NICs

Credit goes to the every knowledgeable hamelic for his help.