출처: https://twpower.github.io/207-network-bonding-active-backup-fail-over-mac-option
네트워크 본딩(Network Bonding)을 할 때 active-backup
모드에서 fail_over_mac
옵션에 대해 알아보자
fail_over_mac
: bond된 인터페이스와 slave 인터페이스들간에 어떻게 MAC 주소를 가져갈지 정하는 옵션으로 설정된 값에 따라 bond된 인터페이스와 slave 인터페이스들의 MAC을 설정하는 방식이 달라진다.bonding mode가 active-backup 방식일때만 사용
되는 옵션이다.none
or 0
: (Default) bond된 인터페이스와 모든 slave 인터페이스들의 MAC이 같은 값으로 설정되는 옵션으로 보통 가장 첫번째 slave 인터페이스의 MAC 주소를 모든 bond된 인터페이스와 slave 인터페이스들이 갖는다.active
or 1
: active 상태인 slave 인터페이스의 MAC 주소를 bond된 인터페이스의 MAC으로 설정하는 옵션으로 failover된 상황에서 active 상태인 slave에 따라에 bond된 인터페이스의 MAC 주소가 달라진다.follow
or 2
: bond된 인터페이스의 MAC 주소는 고정이고(보통 첫번째 slave 인터페이스의 MAC 주소를 갖는다.) active 상태가 되는 slave 인터페이스 MAC 주소에 해당 MAC 주소를 부여하는 방식이다. failover가 일어날때 새로 active 상태가 될 인터페이스의 MAC 주소를 이전의 active 상태였던 인터페이스에 부여하고 bond된 인터페이스의 MAC을 받는다.[root@centos-client ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 | grep fail_over_mac BONDING_OPTS="mode=1 miimon=100 fail_over_mac=0"
[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
[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의 MAC 주소와 첫번째 slave인 enp0s8의 MAC 주소가 동일 [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
ip link set dev enp0s8 down
[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
[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의 MAC 주소와 첫번째 slave인 enp0s8의 MAC 주소가 동일 [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
ip link set dev enp0s8 down
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
기본적인 본딩 설정은 아래와 같습니다.
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"
NAME=enp0s8 DEVICE=enp0s8 TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes
NAME=enp0s9 DEVICE=enp0s9 TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes