CentOS Bonding Interfaces

Jun 2017

Introduction

For network redundancy, we can bond interface pairs on the G6/G7 servers. For this example I am using CentOS 6.x, so luckily still have the ethx naming convention.
Two bond a pair of interfaces requires three files (four if you want to do some multicast routing). first we will look at bonding a pair of interfaces for management, then we can look at bonding a pair of interfaces for ingest/egress.

Management Interface Bonding

For bonding the management interfaces, we will require three files. I am making the assumption that we are using the first two interfaces (eth0 and eth1) for management, and that this is our first bond on this device (so bond0):

ifcfg-eth0
ifcfg-eth1
ifcfg-bond0

For this to work, you will need the UUID of each interface, if you don't have this, look here for instructions on how to generate the UUIDs.

ifcfg-eth0

DEVICE=eth0
HWADDR=00:1E:67:EB:6D:F2
TYPE=Ethernet
UUID=cceda895-dd2b-4096-9d9c-5985dd0872d7
ONBOOT=yes
MASTER=bond0
SLAVE=yes

Notice that there is no addressing information in the interface configuration file(s)

ifcfg-eth1

DEVICE=eth1
HWADDR=00:1E:67:EB:6D:F3
TYPE=Ethernet
UUID=7ecc849f-eefb-43a0-9796-99d368bbb28a
ONBOOT=yes
MASTER=bond0
SLAVE=yes

ifcfg-bond0

InDEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
USERCTL=no
BONDING_OPTS="mode=1 miimon=100"
IPADDR=192.168.27.100
NETMASK=255.255.255.0
GATEWAY=192.168.27.254
DNS1=172.16.178.100
DNS2=8.8.8.8

So ifcfg-eth0 and ifcfg-eth1 don't contain any address information, but they both contain the entry MASTER=bond0 to tie them to a particular bond file.
ifcfg-bond0 contains all of the addressing information for the two interfaces that are bonded (ifcfg-eth0 and ifcfg-eth1)
Reboot the server, and you should be able to ping the management address (192.168.27.100 in this case) and if you only unplug one interface at a time, the pings should continue (you might miss one or two pings during transition).
miimon specifies the MII link monitoring frequency in milliseconds. This determines how often the link state of each slave is inspected for link failures. A value of zero disables MII link monitoring. A value of 100 is a good starting point.

Ingress/Egress Interface Bonding

For bonding the ingress/egress interfaces, we will require four files. I am making the assumption that we are using the second two interfaces (eth2 and eth3) for Egress, and that this is the second bond on this device (so bond1, bond0 being for Management):

ifcfg-eth2
ifcfg-eth3
ifcfg-bond1
route-bond1

So ifcfg-eth2 and ifcfg-eth3 are the interface configuration files, again they contain no addressing:

ifcfg-eth2

DEVICE=eth2
HWADDR=00:1E:67:F2:63:12
TYPE=Ethernet
UUID=6530a0c3-592d-44d0-8418-b6795818cf55
ONBOOT=yes
MASTER=bond1
SLAVE=yes

ifcfg-eth3

DEVICE=eth3
HWADDR=00:1E:67:F2:63:13
TYPE=Ethernet
UUID=13c99bfe-03f9-44c8-8a91-277dbd2c192b
ONBOOT=yes
MASTER=bond1
SLAVE=yes

Now we have the bond file (ifcfg-bond1) that contains the IP Addressing

ifcfg-bond1

DEVICE=bond1
ONBOOT=yes
BOOTPROTO=static
USERCTL=no
BONDING_OPTS="mode=1 miimon=100"
IPADDR=11.0.100.1
NETMASK=255.0.0.0

Finally we have a routing file (route-bond1) that is for the multicast routing (so we know our incoming multicast will be available on this interface/bond)

route-bond1

ADDRESS0=239.0.0.0
NETMASK0=255.0.0.0
GATEWAY0=11.0.100.1

NOTE! the routes must start from 0 (ADDRESS0, NETMASK0, GATEWAY0) and if there is more than one route the numbering must be contiguous.

Route

Below we can see the route information with the bondx entries in the right hand column.

Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.27.0 * 255.255.255.0 U 0 0 0 bond0
link-local * 255.255.0.0 U 1004 0 0 eth4
link-local * 255.255.0.0 U 1005 0 0 eth5
link-local * 255.255.0.0 U 1008 0 0 eth7
link-local * 255.255.0.0 U 1009 0 0 eth6
link-local * 255.255.0.0 U 1010 0 0 bond0
link-local * 255.255.0.0 U 1011 0 0 bond1
239.0.0.0 11.0.100.1 255.0.0.0 UG 0 0 0 bond1
10.0.0.0 * 255.0.0.0 U 0 0 0 eth4
11.0.0.0 * 255.0.0.0 U 0 0 0 bond1
default 192.168.27.254 0.0.0.0 UG 0 0 0 bond0