본문 바로가기

지식창고/Linux

[리눅스/Linux] Network bonding(본딩) 설정 방법

반응형
#1. 개요
  • bonding(본딩)은 물리적인 네트워크 NIC를 논리적으로 묶어서 사용하는 방법입니다.
  • 설정에 따라 Active-Standby 형태로도 사용할 수 있습니다.
  • Windows에서 사용하는 티밍(teaming)과 유사하다고 생각하시면 됩니다.
#2. 설정 방법(NIC)
  • 설정 테스트를 하기 전 물리적으로 두 개의 NIC가 필요합니다.
  • ifconfig 또는 ip address 명령어를 통해 네트워크 설정을 확인해 줍니다.
  • 해당 테스트의 경우 enp0s3과 enp0s8를 본딩 처리하려고 합니다.
[root@localhost /]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.70  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::a00:27ff:fe8d:1317  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:8d:13:17  txqueuelen 1000  (Ethernet)
        RX packets 843  bytes 81053 (79.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 259  bytes 50665 (49.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.43  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::d5bb:62b0:521:f259  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:14:aa:15  txqueuelen 1000  (Ethernet)
        RX packets 524  bytes 44048 (43.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14  bytes 1756 (1.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 82  bytes 10218 (9.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 82  bytes 10218 (9.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost /]# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:8d:13:17 brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.70/24 brd 192.168.100.255 scope global noprefixroute enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe8d:1317/64 scope link
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:14:aa:15 brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.43/24 brd 192.168.100.255 scope global noprefixroute dynamic enp0s8
       valid_lft 6812sec preferred_lft 6812sec
    inet6 fe80::d5bb:62b0:521:f259/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
  • enp0s3, enp0s8의 설정 파일을 수정해줍니다.
[root@localhost /]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ls -al | grep ifcfg-enp
-rw-r--r--. 1 root root   393 12월 15 11:18 ifcfg-enp0s3
-rw-r--r--  1 root root   393 12월 21 10:06 ifcfg-enp0s8
# ifcfg-enp0s3

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=enp0s3
DEVICE=enp0s3
ONBOOT=yes
MASTER=bond0
SLAVE=yes
NM_CONTROLLED=no

# ifcfg-enp0s8

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=enp0s8
DEVICE=enp0s8
ONBOOT=yes
MASTER=bond0
SLAVE=yes
NM_CONTROLLED=no
#3. 설정 방법(bonding)
  • bond0 생성 및 설정 파일 수정
  • mode=1(Active or Backup 설정), miimon=100(모니터링 주기)
[root@localhost network-scripts]# vi ifcfg-bond0

# ifcfg-bond0

TYPE=Ethernet
PROXY_METHOD=none
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=bond0
DEVICE=bond0
ONBOOT=yes
NM_CONTROLLED=no
IPADDR=192.168.100.70
NETMASK=255.255.255.0
GATEWAY=192.168.100.254
DNS1=168.126.63.1
DNS2=168.126.63.2
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
  • 네트워크 재시작하여 본딩 설정을 확인해줍니다.
[root@localhost network-scripts]# systemctl restart network
[root@localhost network-scripts]# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
    link/ether 08:00:27:8d:13:17 brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
    link/ether 08:00:27:8d:13:17 brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 08:00:27:8d:13:17 brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.70/24 brd 192.168.100.255 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe8d:1317/64 scope link
       valid_lft forever preferred_lft forever

 

반응형