[Network](EN) Network bonding active-backup mode fail_over_mac option
About fail_over_mac option in network bonding active-backup mode
Environment and Prerequisite
- CentOS 7.7.1908
- Bash shell(/bin/bash)
- Network bonding
fail_over_mac option
About fail_over_mac option
![](/images/20200101_206/Structure.png)
fail_over_mac
: It is an option which choose how to allocate MAC address to each bond and slave interfaces. Depends on its option value, the way which allocate MAC address to bond and slave interfaces changes.- This option is only valid in
active-backup
mode bonding. - Image reference source: https://www.ibm.com/support/knowledgecenter/en/linuxonibm/com.ibm.linux.z.l0wlcb00/l0wlcb00_optionfailovermac.html
fail_over_mac option types
none
or0
: (Default) This setting disables fail_over_mac and sets all of the bond and slave interfaces to the same MAC address. Usually first slave’s MAC address is allocated to all bond and slave interfaces.active
or1
: The bond interface’s MAC address is always the MAC address of the active slave interface. If the active slave interface is changed during a failover, the bond interface’s MAC address is then changed to match the new active slave’s MAC address.follow
or2
: The bond interface’s MAC address is fixed(Usually first slave’s MAC address is allocated) and it gives its MAC address to newly active slave interface. If the slave is changed during a failover, the active slave will get the MAC address of the bond interface and the formerly active slave interface receives the newly active slave’s MAC address.
fail_over_mac option examples
Example running environment
- Example bonding setting is in (Ref) Bonding Setting
- Host OS: Mac OS
- Guest OS: CentOS 7.7.1908
- Hypervisor: VirtualBox
none or 0 option example
- Default option
- fail_over_mac=0
- In VirtualBox environment, it is not work well.
[root@centos-client ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 | grep fail_over_mac
BONDING_OPTS="mode=1 miimon=100 fail_over_mac=0"
- bond0’s and slaves’(enp0s8 and enp0s9) MAC addresses are same.
[root@centos-client ~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:2b:04:6e brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:e8:26:58 brd ff:ff:ff:ff:ff:ff
4: enp0s9: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:e8:26:58 brd ff:ff:ff:ff:ff:ff
8: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:e8:26:58 brd ff:ff:ff:ff:ff:ff
active or 1 option example
- fail_over_mac=1
[root@centos-client ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 | grep fail_over_mac
BONDING_OPTS="mode=1 miimon=100 fail_over_mac=1"
- bond0’s MAC address and first slave’s(enp0s8) MAC address are same.
[root@centos-client ~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:2b:04:6e brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:e8:26:58 brd ff:ff:ff:ff:ff:ff
4: enp0s9: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:27:a9:2d brd ff:ff:ff:ff:ff:ff
9: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:e8:26:58 brd ff:ff:ff:ff:ff:ff
- Link down enp0s8 interface
ip link set dev enp0s8 down
- bond0’s MAC address is changed to enp0s9’s MAC address.
[root@centos-client ~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:2b:04:6e brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST,SLAVE> mtu 1500 qdisc pfifo_fast master bond0 state DOWN mode DEFAULT group default qlen 1000
link/ether 08:00:27:e8:26:58 brd ff:ff:ff:ff:ff:ff
4: enp0s9: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:27:a9:2d brd ff:ff:ff:ff:ff:ff
9: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:27:a9:2d brd ff:ff:ff:ff:ff:ff
follow or 2 option example
- fail_over_mac=2
- In VirtualBox environment, it is not work well.
[root@centos-client ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 | grep fail_over_mac
BONDING_OPTS="mode=1 miimon=100 fail_over_mac=2"
- bond0’s MAC address and first slave’s(enp0s8) MAC address are same.
[root@centos-client ~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:2b:04:6e brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:e8:26:58 brd ff:ff:ff:ff:ff:ff
4: enp0s9: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:27:a9:2d brd ff:ff:ff:ff:ff:ff
10: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:e8:26:58 brd ff:ff:ff:ff:ff:ff
- Link down enp0s8 interface
ip link set dev enp0s8 down
- bond0’s MAC address is same as before.
- bond0’s MAC address is allocated to newly active slave(enp0s9)
- enp0s9’s previous MAC address is moved to enp0s8’s MAC address which is failed.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:2b:04:6e brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST,SLAVE> mtu 1500 qdisc pfifo_fast master bond0 state DOWN mode DEFAULT group default qlen 1000
link/ether 08:00:27:27:a9:2d brd ff:ff:ff:ff:ff:ff
4: enp0s9: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:e8:26:58 brd ff:ff:ff:ff:ff:ff
10: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:e8:26:58 brd ff:ff:ff:ff:ff:ff
(Ref) Bonding Setting
- Basic bonding settings are like below.
Interfaces
- Bonding Interface: bond0
- Slave Interfaces: enp0s8, enp0s9
bond0
- /etc/sysconfig/network-scripts/ifcfg-bond0
IPADDR
andPREFIX
could be different.fail_over_mac
can set be from 0 to 2.
TYPE=Bond
BOOTPROTO=static
DEFROUTE=no
NAME=bond0
DEVICE=bond0
ONBOOT=yes
PREFIX=24
IPADDR=192.168.99.101
BONDING_OPTS="mode=1 miimon=100 fail_over_mac=1"
enp0s8, enp0s9
- /etc/sysconfig/network-scripts/ifcfg-enp0s8
NAME=enp0s8
DEVICE=enp0s8
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
- /etc/sysconfig/network-scripts/ifcfg-enp0s9
NAME=enp0s9
DEVICE=enp0s9
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes