코드 작성을 시작하기 전에 상황을 설명하겠습니다. 두 개의 인터페이스를 설정하여 함께 결합한 다음 이 조합에서 브리지를 만들려고 합니다.
저는 RHCE에 대해 배워왔고 이것이 테스트에 나타날 수도 있다고 생각하여 내려놓으려고 노력했지만 모든 테스트에서 제대로 작동하지 못했습니다. 설정이 끝나면 브리지가 존재하는 것처럼 보이지만 브리지에 할당된 IP가 없으며 게이트웨이를 핑할 수 없습니다.
테스트 환경은 kvm의 가상머신이며 내부 네트워크를 사용해왔습니다.
Starting Interfaces
4: ens10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
5: ens11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:7c:68:d0 brd ff:ff:ff:ff:ff:ff
Creating Team w/ ens10 & ens11
nmcli con add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'
Connection 'team0' (75299245-c21f-4bfc-8c21-1728378d5a33) successfully added.
nmcli con add type team-slave con-name team0-port1 ifname ens10 master team0 Connection 'team0-port1' (68ee3568-bb1d-4f66-a2a2-31ea756da2f4) successfully added.
nmcli con add type team-slave con-name team0-port2 ifname ens11 master team0 Connection 'team0-port2' (0569a1de-2280-4087-b026-2e22afc11c79) successfully added.
teamdctl team0 state
setup:
runner: activebackup
ports:
ens10
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
ens11
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
runner:
active port: ens10
6: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
inet 192.168.100.136/24 brd 192.168.100.255 scope global dynamic team0
valid_lft 3460sec preferred_lft 3460sec
inet6 fe80::5054:ff:fe60:2623/64 scope link
valid_lft forever preferred_lft forever
Teamed Interface Pinging Gateway
ping -I team0 192.168.100.1
PING 192.168.100.1 (192.168.100.1) from 192.168.100.136 team0: 56(84) bytes of data.
64 bytes from 192.168.100.1: icmp_seq=10 ttl=64 time=0.703 ms
64 bytes from 192.168.100.1: icmp_seq=11 ttl=64 time=0.253 ms
64 bytes from 192.168.100.1: icmp_seq=12 ttl=64 time=0.239 ms
64 bytes from 192.168.100.1: icmp_seq=13 ttl=64 time=0.244 ms
64 bytes from 192.168.100.1: icmp_seq=14 ttl=64 time=0.240 ms
64 bytes from 192.168.100.1: icmp_seq=15 ttl=64 time=0.290 ms ^C
--- 192.168.100.1 ping statistics ---
15 packets transmitted, 6 received, 60% packet loss, time 14000ms rtt min/avg/max/mdev = 0.239/0.328/0.703/0.168 ms
Bridge Setup
yum install -y bridge-utils
systemctl disable NetworkManager
rm '/etc/systemd/system/multi-user.target.wants/NetworkManager.service'
rm '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service'
rm '/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service'
systemctl stop NetworkManager
echo 'BRIDGE=brteam0' >> /etc/sysconfig/network-scripts/ifcfg-team0
cat /etc/sysconfig/network-scripts/ifcfg-team0
DEVICE=team0
TEAM_CONFIG="{\"runner\": {\"name\": \"activebackup\"}}"
DEVICETYPE=Team
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=team0
UUID=75299245-c21f-4bfc-8c21-1728378d5a33
ONBOOT=yes
BRIDGE=brteam0
cat /etc/sysconfig/network-scripts/ifcfg-team0-port1
NAME=team0-port1
UUID=68ee3568-bb1d-4f66-a2a2-31ea756da2f4
DEVICE=ens10
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort
cat /etc/sysconfig/network-scripts/ifcfg-team0-port2
NAME=team0-port2
UUID=0569a1de-2280-4087-b026-2e22afc11c79
DEVICE=ens11
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort
cat /etc/sysconfig/network-scripts/ifcfg-brteam0
DEVICE=team0
ONBOOT=yes
TYPE=Bridge
IPADDR0=192.168.100.100
PREFIX0=24
systemctl restart network
Bridge Interface Stays Down With No IP?
4: ens10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe60:2623/64 scope link
valid_lft forever preferred_lft forever
5: ens11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe7c:68d0/64 scope link
valid_lft forever preferred_lft forever
7: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master brteam0 state UP
link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe60:2623/64 scope link
valid_lft forever preferred_lft forever
8: brteam0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
Turn Up Interface And Still No IP?
ip link set brteam0 up
4: ens10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe60:2623/64 scope link
valid_lft forever preferred_lft forever
5: ens11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000
link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe7c:68d0/64 scope link
valid_lft forever preferred_lft forever
7: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master brteam0 state UP
link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe60:2623/64 scope link
valid_lft forever preferred_lft forever
8: brteam0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 52:54:00:60:26:23 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe60:2623/64 scope link
valid_lft forever preferred_lft forever
Bridge Shows Active Interfaces?
brctl show
bridge name bridge id STP enabled interfaces
brteam0 8000.525400602623 no team0
답변1
이제 ifcfg-brteam0에 정의되어 있으므로 ifcfg-team0에서 IP 매개변수(BOOTPROTO, ...)를 제거할 수 있습니다.
ifcfg-team0은 다음과 같이 짧을 수 있습니다.
DEVICE=team0 TEAM_CONFIG="{\"runner\": {\"name\": \"activebackup\"}}" DEVICETYPE=Team NAME=team0 UUID=75299245-c21f-4bfc-8c21-1728378d5a33 ONBOOT=yes BRIDGE=brteam0
ifcfg-brteam0에서 DEVICE 값을 수정해야 합니다. 예를 들면 다음과 같습니다.
DEVICE=brteam0
ifcfg-team0은 이미 OP에서 team0 대신 이 값을 사용하고 있습니다.