Main Menu

Search

Linux: How To Do Network Bond Interfaces Failover Testing?

Procedure provides detailed steps for testing the Linux bond failover for Linux environments where there are multiple slaves set for each network bond for high availability.

For e.g. if you have network bond bond0 which has bonding configuration file /etc/sysconfig/network-scrips/ifcfg-bond0 file with below entries.

DEVICE=bond0
ONBOOT=yes
MASTER=yes
IPADDR=10.10.10.20
NETMASK=255.255.255.0
GATEWAY=10.10.240.240
BONDING_OPTS="mode=1 miimon=100"
TYPE=Ethernet

And lets assume you have two slaves eth0 and eth1 for bond0 with below entries inside ifcfg-eth0 and ifcfg-eth1.

ifcfg-eth0

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
SLAVE=yes 


ifcfg-eth1

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
SLAVE=yes 

So you want to do network bond failover testing for bond0 by shutting down on slave (eth0 or eth1) at a time, below are the steps to follow.


1. Open a command window on local windows machine and do continuous pings to Linux Host using below command to the bond0 IP address, In this case IP will be 10.10.10.20

ping -t <IP>

2. Now list the slaves for network bond interface using below command. In this example bondX will be bond0.

cat /proc/net/bonding/bondX

You will see that both the slaves will be up, they can in active-active or active-backup mode based on the bonding options.


3. Bring down one the slaves slave as follows. It can be either eth0 or eth1

ip link set dev <slave> down

Wait for about 15 seconds. Check the slaves of bond using below command

cat /proc/net/bonding/bondX

You will see one of the slaves as down which you brought down.Check if there are any issues with the ping tests from windows command prompt from step (1)


4. Bring up the slave you brought down in above step (3) using below command

ip link set dev <slave> up

Wait for 15 seconds and then run below command, replace bondX as needed with bond/interface name.

cat /proc/net/bonding/bondX

You will see both the slaves up now.


5. Now bring down the other slave now by running below command

ip link set dev <slave> down

Wait for about 15 seconds and then run below command.

cat /proc/net/bonding/bondX

You will see one of the slaves as down which you brought down in step (5). Check if there are any issues with the ping tests in above step (1).


6. Now bring back slave you stopped in above step (5) again by running below command.

ip link set dev <slave> up

Wait for about 15 seconds and then run below command.

cat /proc/net/bonding/bondX

You will see both the slaves up.



Products to which Article Applies


For this tutorial, the steps were tested on Oracle Linux. But the steps are applicable also to CentOS and Red Hat OS.

Additional Reference

https://www.cyberciti.biz/faq/linux-ip-command-examples-usage-syntax/
https://www.howtoforge.com/tutorial/how-to-configure-high-availability-and-network-bonding-on-linux/







tarun boyella

No comments:

Post a Comment