Redundant Networking on Red Hat

Redundant Networking on Red Hat

From Consultancy.EdVoncken.NET

Jump to: navigation, search

Under RHEL or CentOS, redundant networking is accomplished using the Channel Bonding module.

Contents

Loading the module

Put the following lines at the top of /etc/modprobe.conf (before any other network modules):

 alias bond0 bonding
 options bond0 mode=1 miimon=100 primary=eth0

Putting the bonding-interface at the top ensures that SNMP-based tools see the correct interface. This is explained in the Linux Kernel documentation, "bonding.txt".

Here, we assume that eth0 is your primary (active) interface. See if this works by probing:

 # modprobe bond0
 # lsmod

Look at /var/log/messages for errors and warnings.

Important parameters

mode=1 
Sets an active-backup policy for fault tolerance. Transmissions are received and sent out via the first available bonded slave interface. Another bonded slave interface is only used if the active bonded slave interface fails.
miimon=100 
Specifies (in milliseconds) how often MII link monitoring occurs. This is useful if high availability is required because MII is used to verify that the NIC is active.
primary=eth0 
Specifies the interface name, such as eth0, of the primary device. The primary device is the first of the bonding interfaces to be used and is not abandoned unless it fails.

Configuring the interfaces

  • Create a new configuration file for the bonding interface, for example /etc/sysconfig/network-scripts/ifcfg-bond0
  • Set the IP-address parameters on the bonding interface
  • Remove the IP-address parameters from the primary and secondary interfaces
  • Set the appropriate MASTER/SLAVE variables on the primary and secondary interfaces

Sample /etc/sysconfig/network-scripts/ifcfg-bond0:

 # Channel bonding to increase availability on Production LAN
 DEVICE=bond0
 BOOTPROTO=static
 IPADDR=192.168.99.123
 NETMASK=255.255.255.0
 ONBOOT=yes
 TYPE=Ethernet

Sample /etc/sysconfig/network-scripts/ifcfg-eth0:

 # Primary Link - Connected to Production LAN
 DEVICE=eth0
 HWADDR=00:11:22:33:44:55
 BOOTPROTO=none
 ONBOOT=yes
 MASTER=bond0
 SLAVE=yes
 USERCTL=no

Sample /etc/sysconfig/network-scripts/ifcfg-eth2:

 # Secondary Link - Connected to Production LAN
 DEVICE=eth0
 HWADDR=00:11:22:33:44:66
 BOOTPROTO=none
 ONBOOT=yes
 MASTER=bond0
 SLAVE=yes
 USERCTL=no

There are some options in these files that can be removed, we'll sort that out later on.

Now, let's see if this works in practice:

 # rmmod bonding
 # modprobe bond0
 # service network restart

You may wish to reboot the server, to see if the settings are persistent across reboots.

You should be in business now...

Verify network settings

Check the status of your bonded interface as follows:

 [root@rhel40 ~]# cat /proc/net/bonding/bond0
 Ethernet Channel Bonding Driver: v2.6.3-rh (June 8, 2005)
 
 Bonding Mode: fault-tolerance (active-backup)
 Primary Slave: eth0
 Currently Active Slave: eth0
 MII Status: up
 MII Polling Interval (ms): 100
 Up Delay (ms): 0
 Down Delay (ms): 0
 
 Slave Interface: eth0
 MII Status: up
 Link Failure Count: 0
 Permanent HW addr: 00:11:22:33:44:55
 
 Slave Interface: eth2
 MII Status: up
 Link Failure Count: 0
 Permanent HW addr: 00:11:22:33:44:66

Check the network configuration as follows:

 [root@rhel40 ~]# ifconfig
 bond0   Link encap:Ethernet  HWaddr 00:11:22:33:44:55
         inet addr:192.168.99.123  Bcast:192.168.99.255  Mask:255.255.255.0
         inet6 addr: fe80::212:ccff:ff88:ee66/64 Scope:Link
         UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
         RX packets:19608 errors:0 dropped:0 overruns:0 frame:0
         TX packets:1483 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0
         RX bytes:1305525 (1.2 MiB)  TX bytes:151076 (147.5 KiB)
 eth0    Link encap:Ethernet  HWaddr 00:11:22:33:44:55
         inet6 addr: fe80::212:ccff:ff88:ee66/64 Scope:Link
         UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
         RX packets:10415 errors:0 dropped:0 overruns:0 frame:0
         TX packets:1477 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:713283 (696.5 KiB)  TX bytes:150614 (147.0 KiB)
         Interrupt:209
 eth2    Link encap:Ethernet  HWaddr 00:11:22:33:44:55
         inet6 addr: fe80::212:ccff:ff88:ee66/64 Scope:Link
         UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
         RX packets:9193 errors:0 dropped:0 overruns:0 frame:0
         TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:592242 (578.3 KiB)  TX bytes:462 (462.0 b)
         Base address:0xdce0 Memory:dfce0000-dfd00000