我有一个工作配置,其中有一个绑定两个物理接口和多个 VLAN 的团队接口。
ens1f1 ----- |--- team0.1826 (172.18.x.y/28)
|--- team0 -----|--- team0.1651
ens2f0 ----- |--- team9.1655
我需要在此主机上启动 kvm 虚拟机,位于 vlan 1826 网络上。因此,我尝试team0.1826
以以下方式添加包含接口的桥接器:
- 删除之前的 vlan 接口
nmcli con del team0.1826
- 添加桥接接口
nmcli connection add type bridge con-name br0 ifname br0 \
ipv4.method manual ipv4.addresses '172.18.x.y/28' ipv4.gateway '172.18.x.z'
- 重新创建 vlan 接口,作为网桥的从属接口
nmcli connection add type vlan con-name team01826 ifname team0.1826 \
dev team0 id 1826 master br0 slave-type bridge
碰巧的是,我一运行最后一条命令,所有接口(包括物理接口)就都关闭了。我猜这样做会以某种方式破坏与交换机的 LACP 通信,从而导致接口关闭。但是我不明白我做错了什么以及如何使它正常工作。我一删除新的桥接从属接口team0.1826
,接口就会再次打开。
一些附加信息:
- team0 配置
$ cat ifcfg-team0
PROXY_METHOD=none
BROWSER_ONLY=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=team0
UUID=24c8380b-43ca-4977-9dc0-27e27e3ec387
DEVICE=team0
ONBOOT=yes
DEVICETYPE=Team
TEAM_CONFIG="{\"device\": \"team0\", \"runner\": {\"name\": \"lacp\", \"fast_rate\": true, \"tx_hash\": [\"eth\", \"ipv4\", \"ipv6\"]}, \"link_watch\": {\"name\": \"ethtool\"}, \"ports\": {\"ens1f1\": {}, \"ens2f0\": {}}}"
我尝试过在
br0
接口上使用和不使用 STP,以防发生冲突,但没有变化。在
"debug_level: 2"
团队配置中,以及在调试级别的网络管理器中,我有这些日志,但似乎其中没有任何相关内容:
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5499] ifcfg-rh: add connection /etc/sysconfig/network-scripts/ifcfg-team0.1826 (c5726afe-2458-492c-9089-f6828559ab9b,"team0.1826")
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5504] manager: (team0.1826): new VLAN device (/org/freedesktop/NetworkManager/Devices/33)
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5520] audit: op="connection-add" uuid="c5726afe-2458-492c-9089-f6828559ab9b" name="team0.1826" pid=1374856 uid=0 result="success"
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5585] device (team0.1826): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5728] device (team0.1826): carrier: link connected
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5744] device (team0.1826): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'managed')
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5799] policy: auto-activating connection 'team0.1826' (c5726afe-2458-492c-9089-f6828559ab9b)
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5805] device (team0.1826): Activation: starting connection 'team0.1826' (c5726afe-2458-492c-9089-f6828559ab9b)
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5806] device (team0.1826): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5811] device (team0.1826): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5836] device (team0.1826): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5923] device (br0): attached bridge port team0.1826
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5923] device (team0.1826): Activation: connection 'team0.1826' enslaved, continuing activation
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5925] device (br0): IPv4 config waiting until carrier is on
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5925] device (br0): IPv6 config waiting until carrier is on
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5926] device (team0.1826): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5933] device (team0.1826): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5935] device (team0.1826): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Sep 11 16:26:39 hostname NetworkManager[1059]: <info> [1599834399.5947] device (team0.1826): Activation: successful, device activated.
Sep 11 16:26:41 hostname NetworkManager[1059]: ens1f1: Changed port state: "current" -> "disabled"
Sep 11 16:26:41 hostname NetworkManager[1059]: ens1f1: ethtool-link went down.
Sep 11 16:26:41 hostname NetworkManager[1059]: ens2f0: Changed port state: "current" -> "disabled"
Sep 11 16:26:41 hostname NetworkManager[1059]: carrier changed to DOWN
Sep 11 16:26:41 hostname NetworkManager[1059]: ens2f0: ethtool-link went down.
Sep 11 16:26:47 hostname NetworkManager[1059]: <info> [1599834407.5362] device (team0.1655): state change: activated -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Sep 11 16:26:47 hostname NetworkManager[1059]: <info> [1599834407.5503] device (team0.1659): state change: activated -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Sep 11 16:26:47 hostname NetworkManager[1059]: <info> [1599834407.5655] manager: NetworkManager state is now CONNECTING
Sep 11 16:26:47 hostname NetworkManager[1059]: <info> [1599834407.5668] manager: NetworkManager state is now CONNECTED_GLOBAL
Sep 11 16:26:47 hostname NetworkManager[1059]: <info> [1599834407.5669] policy: set 'team0.1661' (team0.1661) as default for IPv4 routing and DNS
Sep 11 16:26:47 hostname NetworkManager[1059]: <info> [1599834407.5676] device (team0.1661): state change: activated -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Sep 11 16:26:47 hostname NetworkManager[1059]: <info> [1599834407.5825] manager: NetworkManager state is now CONNECTING
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.7929] agent-manager: req[0x55ac4d810020, :1.6180426/nmcli-connect/0]: agent registered
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.7941] device (br0): state change: ip-config -> deactivating (reason 'new-activation', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.7944] manager: NetworkManager state is now CONNECTED_LOCAL
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.7947] device (br0): disconnecting for new activation request.
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.7947] audit: op="connection-activate" uuid="42451cd5-641a-45cf-8c4f-be4dc4227136" name="br0" pid=1377109 uid=0 result="success"
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.7947] device (br0): state change: deactivating -> disconnected (reason 'new-activation', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8127] device (br0): detached bridge port team0.1826
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8143] device (br0): Activation: starting connection 'br0' (42451cd5-641a-45cf-8c4f-be4dc4227136)
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8149] device (team0.1826): state change: activated -> disconnected (reason 'new-activation', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8202] device (br0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8205] manager: NetworkManager state is now CONNECTING
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8373] device (team0.1826): state change: disconnected -> unmanaged (reason 'user-requested', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8377] policy: auto-activating connection 'team0.1826' (c5726afe-2458-492c-9089-f6828559ab9b)
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8379] device (br0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8401] device (team0.1826): state change: unmanaged -> unavailable (reason 'user-requested', sys-iface-state: 'external')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8408] device (team0.1826): state change: unavailable -> disconnected (reason 'user-requested', sys-iface-state: 'external')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8414] device (team0.1826): Activation: starting connection 'team0.1826' (c5726afe-2458-492c-9089-f6828559ab9b)
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8414] device (team0.1826): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8419] device (br0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8421] device (br0): IPv4 config waiting until carrier is on
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8421] device (br0): IPv6 config waiting until carrier is on
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8423] device (team0.1826): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8568] device (team0.1826): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8793] device (br0): attached bridge port team0.1826
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8793] device (team0.1826): Activation: connection 'team0.1826' enslaved, continuing activation
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8794] device (br0): IPv4 config waiting until carrier is on
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8795] device (br0): IPv6 config waiting until carrier is on
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8796] device (team0.1826): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8802] device (team0.1826): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8803] device (team0.1826): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Sep 11 16:28:26 hostname NetworkManager[1059]: <info> [1599834506.8814] device (team0.1826): Activation: successful, device activated.
Sep 11 16:29:21 hostname NetworkManager[1059]: <info> [1599834561.1835] device (team0.1826): state change: activated -> deactivating (reason 'connection-removed', sys-iface-state: 'managed')
Sep 11 16:29:21 hostname NetworkManager[1059]: <info> [1599834561.1987] device (br0): detached bridge port team0.1826
Sep 11 16:29:21 hostname NetworkManager[1059]: <info> [1599834561.1987] device (team0.1826): released from master device br0
Sep 11 16:29:21 hostname NetworkManager[1059]: <info> [1599834561.1999] audit: op="connection-delete" uuid="c5726afe-2458-492c-9089-f6828559ab9b" name="team0.1826" pid=1378747 uid=0 result="success"
Sep 11 16:29:21 hostname NetworkManager[1059]: <info> [1599834561.2000] device (team0.1826): state change: deactivating -> disconnected (reason 'connection-removed', sys-iface-state: 'managed')
Sep 11 16:29:21 hostname NetworkManager[1059]: <info> [1599834561.2243] device (team0.1826): state change: disconnected -> unmanaged (reason 'user-requested', sys-iface-state: 'managed')
Sep 11 16:31:41 hostname NetworkManager[1059]: ens1f1: Changed port state: "disabled" -> "expired"
Sep 11 16:31:41 hostname NetworkManager[1059]: ens1f1: ethtool-link went up.
Sep 11 16:31:41 hostname NetworkManager[1059]: <info> [1599834701.6413] device (ens1f1): carrier: link connected
Sep 11 16:31:41 hostname NetworkManager[1059]: ens2f0: Changed port state: "disabled" -> "expired"
Sep 11 16:31:41 hostname NetworkManager[1059]: ens2f0: ethtool-link went up.
Sep 11 16:31:41 hostname NetworkManager[1059]: <info> [1599834701.9899] device (ens2f0): carrier: link connected
Sep 11 16:31:42 hostname NetworkManager[1059]: ens1f1: Changed port state: "expired" -> "current"
Sep 11 16:31:42 hostname NetworkManager[1059]: carrier changed to UP
Sep 11 16:31:42 hostname NetworkManager[1059]: <info> [1599834702.6431] device (team0): carrier: link connected
Sep 11 16:31:42 hostname NetworkManager[1059]: <info> [1599834702.6434] device (team0.1655): carrier: link connected
Sep 11 16:31:42 hostname NetworkManager[1059]: <info> [1599834702.6436] device (team0.1659): carrier: link connected
Sep 11 16:31:42 hostname NetworkManager[1059]: <info> [1599834702.6438] device (team0.1661): carrier: link connected
Sep 11 16:31:42 hostname NetworkManager[1059]: <info> [1599834702.6439] device (team0.1655): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Sep 11 16:31:42 hostname NetworkManager[1059]: <info> [1599834702.6502] device (team0.1659): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Sep 11 16:31:42 hostname NetworkManager[1059]: <info> [1599834702.6564] device (team0.1661): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
有人知道这是怎么发生的,以及如何使它发挥作用吗?
答案1
碰巧的是,我按照以下步骤成功登上了这座桥:
- 将每个连接标记为关闭
nmcli con down team0.1826
nmcli con down team0.1651
nmcli con down team0.1655
nmcli con down team0
nmcli con down ens1f1
nmcli con down ens2f0
重点是:启动前没有启动界面。
- 重新创建没有 IPS 的 VLAN 连接
nmcli con del team0.1826
nmcli con add type vlan con-name team0.1826 ifname team0.1826 dev team0 id 1826
- 创建桥接。我禁用了 STP,但我认为它没有任何影响,只是在 KVM 教程中经常看到这种情况。
nmcli connection add type bridge con-name br0 ifname br0 bridge.stp no
- 将网桥和 VLAN 绑定在一起
nmcli con mod team0.1826 connection.master br0 connection.slave-type bridge
- 配置桥接
nmcli con mod br0 ipv4.method manual ipv4.addresses '172.18.x.y/28' ipv4.gateway '172.18.x.z'
- 开始一切
nmcli con up br0
nmcli con up team0.1826
nmcli con up team0
nmcli con up ens1f1
nmcli con up ens2f0
nmcli con up team0.1651
nmcli con up team0.1655
瞧!桥真的建起来了。
我认为 NetworkManager 可能有点挑剔。我强烈怀疑将 team0.1826
接口拆分为创建并绑定到桥接步骤是成功的关键。