[Network] 네트워크 본딩(Network bonding) active-backup 모드 fail_over_mac 옵션

네트워크 본딩(Network Bonding)을 할 때 active-backup 모드에서 fail_over_mac 옵션에 대해 알아보자


환경

  • CentOS 7.7.1908
  • Bash shell(/bin/bash)
  • Network bonding


fail_over_mac 옵션

fail_over_mac 옵션이란


fail_over_mac 옵션 종류

  • 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을 받는다.


fail_over_mac 옵션 예제

예제 실행 환경

  • 해당 예제의 Bonding 설정은 하단 (참고) Bonding 설정에 있습니다.
  • Host OS: Mac OS
  • Guest OS: CentOS 7.7.1908
  • Hypervisor: VirtualBox


none or 0 옵션 예제

  • Default option
  • fail_over_mac=0
  • VirtualBox에서는 해당 옵션으로 설정하면 active-backup이 잘 안되는 이슈가 있음.
[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와 slave들(enp0s8과 enp0s9)의 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: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 옵션 예제

  • 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의 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
  • enp0s8 인터페이스 Down
ip link set dev enp0s8 down
  • bond0의 MAC 주소가 enp0s9의 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> 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 옵션 예제

  • fail_over_mac=2
  • VirtualBox에서는 해당 옵션으로 설정하면 active-backup이 잘 안되는 이슈가 있음.
[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
  • enp0s8 인터페이스 Down
ip link set dev enp0s8 down
  • bond0의 MAC 주소는 이전과 동일
  • 새로 active 상태가 된 enp0s9 인터페이스에 bond0의 MAC 주소가 할당됨
  • fail이 일어난 enp0s8 인터페이스에는 새로 active 상태가 된 enp0s9 인터페이스의 예전 MAC 주소가 할당됨
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


(참고) Bonding 설정

  • 기본적인 본딩 설정은 아래와 같습니다.

Interfaces

  • Bonding Interface: bond0
  • Slave Interfaces: enp0s8, enp0s9

bond0

  • /etc/sysconfig/network-scripts/ifcfg-bond0
  • IPADDRPREFIX는 환경에 따라 다를 수 있습니다.
  • fail_over_mac 옵션은 0~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


참고자료