We are going to configure an active-backup network bonding on Oracle Linux 6.
Before We Begin
We have two network cards, eth0 and eth1, and will create a bond0 interface with an active-backup policy where only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails.
Configure bond0 Interface
Open /etc/sysconfig/network-scripts/ifcfg-bond0
and add the following lines:
DEVICE=bond0 BONDING_OPTS="mode=1 miimon=100" IPADDR="10.10.1.20" NETMASK="255.255.255.0" GATEWAY"10.10.1.1" PEERDNS=no NM_CONTROLLED=no BOOTPROTO=none USERCTL=no ONBOOT=yes
Make sure you change IPs according to your configuration.
Configure eth0 and eth1 Interfaces
Open /etc/sysconfig/network-scripts/ifcfg-eth0
and add the following lines:
DEVICE=eth0 MASTER=bond0 SLAVE=yes BOOTPROTO=none USERCTL=no ONBOOT=yes
Open /etc/sysconfig/network-scripts/ifcfg-eth1
and add the following lines:
DEVICE=eth1 MASTER=bond0 SLAVE=yes BOOTPROTO=none USERCTL=no ONBOOT=yes
Configure Modprobe
Open /etc/modprobe.conf
and add the following line:
alias bond0 bonding
Create the /etc/modprobe.conf
file if one does not exists. Make sure the bonding module is loaded:
# modprobe bonding
Restart the network service:
# service network restart
Check bond0 Interface
Check bonding configuration:
# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup) Primary Slave: None 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 Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:11:22:33:44:55 Slave queue ID: 0 Slave Interface: eth1 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:11:22:33:44:56 Slave queue ID: 0
We see that it’s configured for fault-tolerance and that the active slave is eth0.
To test, shut down the eth0 interface:
# ifconfig eth0 down
And check bonding configuration again:
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: down
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: 00:11:22:33:44:55
Slave queue ID: 0
Slave Interface: eth1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 00:11:22:33:44:56
Slave queue ID: 0
We see that now the active slave is eth1.
References
http://www.cyberciti.biz/tips/linux-bond-or-team-multiple-network-interfaces-nic-into-single-interface.html