コードの作成を始める前に状況を説明します。 2つのインターフェイスを設定して一緒に結合し、この組み合わせでブリッジを作成しようとしています。
私はRHCEについて学び、これがテストに出てくるかもしれないと思って下ろそうとしましたが、すべてのテストでうまくいきませんでした。設定が終わると、ブリッジが存在するように見えますが、ブリッジに割り当てられたIPがなく、ゲートウェイをpingできません。
テスト環境は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の代わりにこの値を使用しています。