1. 개요
- 이 문서는 두 개의 NIC (
enp5s0f0
,enp5s0f1
)를 bonding(active-backup) 방식으로 구성하고, 해당 bond 장치를 브리지(br0
) 와 연결하여 KVM 가상머신에서 사용할 수 있도록 설정하는 방법을 설명합니다. - 네트워크의 고가용성과 VM 브리지 연결을 동시에 구성하고자 할 때 유용합니다.
2. 버전
- OS: Rocky 8.10
- Network 구성: Bonding(Active-backup) + Bridge(br0)
- 사용된 인터페이스: enp5s0f0, enp5s0f1
3. 용어 설명
3-1. NIC Bonding
- 정의: 두 개 이상의 물리 NIC를 하나로 묶어 하나의 논리 NIC처럼 사용하는 기술.
- 목적:
- 이중화 (Failover): 하나의 NIC 장애 시 다른 NIC가 자동으로 트래픽을 이어받음.
- 부하 분산 (Load Balancing): 특정 모드에서 트래픽을 여러 NIC로 분산 가능.
- 모드 예시:
mode=active-backup
: 하나만 활성화되어 있고, 나머지는 대기.mode=balance-rr
: 순차적으로 트래픽 분배.
3-2. Bridge
- 정의: 여러 네트워크 인터페이스를 하나의 L2 스위치처럼 묶어주는 가상 네트워크 장치.
- 목적:
- 가상머신이 외부 네트워크에 직접 연결된 것처럼 동작하게 함.
- Bond된 NIC 위에 브리지를 구성하여 안정적이고 확장 가능한 가상 네트워크를 구성할 수 있음.
4. Bond 설정
# vim /etc/sysconfig/network-scripts/ifcfg-bond0
설정 예시:
DEVICE=bond0
TYPE=Bond
BONDING_MASTER=yes
BONDING_OPTS="mode=active-backup miimon=100"
ONBOOT=yes
BRIDGE=br0
5. Slave NIC 설정
# vim /etc/sysconfig/network-scripts/ifcfg-enp5s0f0
설정 예시:
DEVICE=enp5s0f0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
# vim /etc/sysconfig/network-scripts/ifcfg-enp5s0f1
설정 예시:
DEVICE=enp5s0f1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
6. Bridge 설정
# vim /etc/sysconfig/network-scripts/ifcfg-br0
설정 예시:
****DEVICE=br0
TYPE=Bridge
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.204.240
NETMASK=255.255.255.0
GATEWAY=192.168.204.253
7. 시스템 재부팅
# reboot
8. 구성 확인
8-1. 인터페이스 상태 확인
# ifconfig
출력 예시:
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
ether 00:25:90:c6:d2:43 txqueuelen 1000 (Ethernet)
RX packets 452501 bytes 39442795 (37.6 MiB)
RX errors 0 dropped 6668 overruns 0 frame 0
TX packets 5012 bytes 513185 (501.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.204.240 netmask 255.255.255.0 broadcast 192.168.204.255
inet6 fe80::225:90ff:fec6:d243 prefixlen 64 scopeid 0x20<link>
ether 00:25:90:c6:d2:43 txqueuelen 1000 (Ethernet)
RX packets 260351 bytes 21459886 (20.4 MiB)
RX errors 0 dropped 9812 overruns 0 frame 0
TX packets 4997 bytes 512771 (500.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp5s0f0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 00:25:90:c6:d2:43 txqueuelen 1000 (Ethernet)
RX packets 267093 bytes 25727466 (24.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5013 bytes 513635 (501.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xc7220000-c723ffff
enp5s0f1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 00:25:90:c6:d2:43 txqueuelen 1000 (Ethernet)
RX packets 185412 bytes 13715569 (13.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xc7200000-c721ffff
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 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:6e:8f:c4 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
bond0
: master 인터페이스, 정상 작동 중br0
: 가상 브리지 인터페이스, IP 주소 보유enp5s0f0
,enp5s0f1
: SLAVE 상태, bond에 묶여 있음
8-2. Bond 상세 상태 확인
# cat /proc/net/bonding/bond0
출력 예시:
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: enp5s0f0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0
Slave Interface: enp5s0f1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:25:90:c6:d2:43
Slave queue ID: 0
Slave Interface: enp5s0f0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:25:90:c6:d2:42
Slave queue ID: 0
- Bonding Mode: active-backup
- Currently Active Slave: enp5s0f0
- Slave Interface: enp5s0f0, enp5s0f1
- Link 상태 및 속도 등 확인 가능