Network Card High Availibility in Linux

3 Comments

My friend called me today and requesting me to help him to solve a network card issue in a Linux box. It is a CentOS 5 box running as a mail server. The network card gives a lot of problem. Every time he need to reboot the box to resolve the network issue. So, I recommend him to purchase two network cards and team/bond them up into a single network card with active-backup policy mode. This mode provides fault tolerance. He agrees with my recommendation. He proceed with the configuration I gave him as below.

1. Append the following line into /etc/modprobe.conf file.

alias bond0 bonding
options bond0 miimon=80 mode=1

2. Create a new interface configuration file for bond0 /etc/sysconfig/network-scripts/ifcfg-bond0 and append the following line into the file.

DEVICE=bond0
IPADDR=192.168.190.128
NETMASK=255.255.255.0
NETWORK=192.168.190.0
BROADCAST=192.168.190.255
GATEWAY=192.168.190.1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

3. Modify the interface configuration file for eth0 /etc/sysconfig/network-scripts/ifcfg-eth0 as below.

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

4. Modify the interface configuration file for eth1 /etc/sysconfig/network-scripts/ifcfg-eth1 as below.

DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes

5. Let’s reboot the box. Run a ifconfig command and the output is as below.

bond0 Link encap:Ethernet HWaddr 00:15:C5:19:22:CC
inet addr:192.168.190.128 Bcast:192.168.190.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe19:22cc/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:594 errors:0 dropped:0 overruns:0 frame:0
TX packets:360 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:61043 (59.6 KiB) TX bytes:73868 (72.1 KiB)

eth0 Link encap:Ethernet HWaddr 00:15:C5:19:22:CC
inet6 addr: fe80::20c:29ff:fe19:22cc/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:462 errors:0 dropped:0 overruns:0 frame:0
TX packets:342 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:45776 (44.7 KiB) TX bytes:70342 (68.6 KiB)
Interrupt:177 Base address:0x1400

eth1 Link encap:Ethernet HWaddr 00:15:C5:19:22:CC
inet6 addr: fe80::20c:29ff:fe19:22cc/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:137 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15567 (15.2 KiB) TX bytes:4944 (4.8 KiB)
Interrupt:185 Base address:0x1480

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:560 (560.0 b) TX bytes:560 (560.0 b)

6. Let’s verify the bonding mode by running this command cat /proc/net/bonding/bond0 and you will get this output below.

Ethernet Channel Bonding Driver: v3.0.3 (March 23, 2006)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 80
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:15:c5:19:22:cc

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:15:c5:19:22:d6

Finally, the fault tolerance network card in the mail server is up and running fine.

Source: HowtoForge

If you found these helpful, please contribute to help:

3 Comments (+add yours?)

  1. simon
    Sep 05, 2007 @ 13:49:21

    great idea..but does it need to plug in 2 cable from and to the switch?

  2. Wing Loon
    Sep 05, 2007 @ 22:42:02

    simon, you need to connect 2 cables to the switch because the kernel bonding will switch from a fault interface to a good working interface.

  3. simon
    Sep 06, 2007 @ 15:24:44

    great…will try it out soon.

Leave a Reply