본문 바로가기
공부/Linux

linux network bonding test(네트워크 이중화 테스트)

by CITTA 2023. 2. 13.
728x90
반응형

1. Network Bonding Test

## 기본 구성 확인
$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v5.15.0-60-generic

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: enp1s0
MII Status: up
MII Polling Interval (ms): 1
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: enp2s0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 1
Permanent HW addr: 56:6f:4e:95:00:a4
Slave queue ID: 0

Slave Interface: enp1s0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 1
Permanent HW addr: 56:6f:4e:95:00:a3
Slave queue ID: 0

## /proc/net/bonding/bond0 에서 확인한 currently active slave nic를 먼저 down
$ ifconfig enp1s0 down

## /proc/net/bonding/bond0, network 확인
$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v5.15.0-60-generic

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
**Currently Active Slave: enp2s0**     <- 변경 확인
MII Status: up
MII Polling Interval (ms): 1
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: enp2s0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 1
Permanent HW addr: 56:6f:4e:95:00:a4
Slave queue ID: 0

Slave Interface: enp1s0
**MII Status: down**             <- 변경 확인
Speed: Unknown
Duplex: Unknown
Link Failure Count: 2
Permanent HW addr: 56:6f:4e:95:00:a3
Slave queue ID: 0

$ ifconfig
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500
        inet 192.168.130.141  netmask 255.255.254.0  broadcast 192.168.131.255
        inet6 fe80::184d:5eff:feae:6b02  prefixlen 64  scopeid 0x20<link>
        ether 1a:4d:5e:ae:6b:02  txqueuelen 1000  (Ethernet)
        RX packets 2453  bytes 233140 (233.1 KB)
        RX errors 0  dropped 398  overruns 0  frame 0
        TX packets 353  bytes 43176 (43.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp2s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether 1a:4d:5e:ae:6b:02  txqueuelen 1000  (Ethernet)
        RX packets 3329  bytes 316138 (316.1 KB)
        RX errors 0  dropped 440  overruns 0  frame 0
        TX packets 377  bytes 45747 (45.7 KB)
        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 24  bytes 2032 (2.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 24  bytes 2032 (2.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

## 원상 복구 후 확인
$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v5.15.0-60-generic

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: enp2s0    <- enp1s0이 up이 되었으나 그대로
MII Status: up
MII Polling Interval (ms): 1
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: enp2s0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 1
Permanent HW addr: 56:6f:4e:95:00:a4
Slave queue ID: 0

Slave Interface: enp1s0
**MII Status: up**             <- 변경 확인
Speed: Unknown
Duplex: Unknown
Link Failure Count: 2
Permanent HW addr: 56:6f:4e:95:00:a3
Slave queue ID: 0

$ ifconfig
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500
        inet 192.168.130.141  netmask 255.255.254.0  broadcast 192.168.131.255
        inet6 fe80::184d:5eff:feae:6b02  prefixlen 64  scopeid 0x20<link>
        ether 1a:4d:5e:ae:6b:02  txqueuelen 1000  (Ethernet)
        RX packets 3211  bytes 302042 (302.0 KB)
        RX errors 0  dropped 567  overruns 0  frame 0
        TX packets 426  bytes 50710 (50.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp1s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether 1a:4d:5e:ae:6b:02  txqueuelen 1000  (Ethernet)
        RX packets 3129  bytes 293446 (293.4 KB)
        RX errors 0  dropped 677  overruns 0  frame 0
        TX packets 20  bytes 2269 (2.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp2s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether 1a:4d:5e:ae:6b:02  txqueuelen 1000  (Ethernet)
        RX packets 3664  bytes 345766 (345.7 KB)
        RX errors 0  dropped 440  overruns 0  frame 0
        TX packets 450  bytes 53281 (53.2 KB)
        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 24  bytes 2032 (2.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 24  bytes 2032 (2.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
s0) NIC 
## 두번째(enp2s0) down
$ ifconfig enp2s0 down

## 확인
$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v5.15.0-60-generic

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
**Currently Active Slave: enp1s0**   <- 변경 확인
MII Status: up
MII Polling Interval (ms): 1
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: enp2s0
**MII Status: down**          <- 변경 확인         
Speed: Unknown   
Duplex: Unknown
Link Failure Count: 2
Permanent HW addr: 56:6f:4e:95:00:a4
Slave queue ID: 0

Slave Interface: enp1s0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 2
Permanent HW addr: 56:6f:4e:95:00:a3
Slave queue ID: 0

## 테스트 진행 시 별도의 원격 창을 띄워두고 gateway로 ping 통신 check
$ ping 192.168.130.1
PING 192.168.130.1 (192.168.130.1) 56(84) bytes of data.
64 bytes from 192.168.130.1: icmp_seq=1 ttl=64 time=0.105 ms
64 bytes from 192.168.130.1: icmp_seq=2 ttl=64 time=0.093 ms
64 bytes from 192.168.130.1: icmp_seq=3 ttl=64 time=0.107 ms
64 bytes from 192.168.130.1: icmp_seq=4 ttl=64 time=0.115 ms
...

NIC 중지 및 Active-backup 전환 시에 끊김이 없는지, 정상 동작 수행하는지
확인 할 수 있음

 

2. active nic(current nic)를 command로 수동 변경해야 할 경우

## 기본 구성
$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v5.15.0-60-generic

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: enp1s0
MII Status: up
...

Slave Interface: enp2s0
MII Status: up
...

Slave Interface: enp1s0
MII Status: up
...

## 아래 명령어로 변경
$ ifenslave -c bond0 enp2s0 

## 확인
$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v5.15.0-60-generic

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: enp2s0
MII Status: up
...

Slave Interface: enp2s0
MII Status: up
...

Slave Interface: enp1s0
MII Status: up
...
728x90
반응형

'공부 > Linux' 카테고리의 다른 글

Linux top 명령어 & 단축키  (0) 2023.02.23
Linux bonding 구성 종류  (0) 2023.02.13
Linux Lvm create, extend and reduce  (0) 2023.02.07
chrony를 이용한 시간 동기화  (0) 2023.02.03
CentOS 8 NFS 서버 및 설정  (0) 2021.11.11

댓글