在基于 RHEL 的系统上,网络应该由 NetworkManager 管理。我想构建一个持久的 VLAN 感知桥配置,该配置在重新启动后仍然有效。基于AB 的出色回答,我为运行 Alma Linux 9.4 的虚拟机创建了一个网络配置,该虚拟机接收 VLAN 1 标记的流量,并且可从管理 VLAN 访问。但如何使其持久?可以使用标准网络管理工具 NetworkManager 来完成吗?
# cat mkbr2.sh
ip link add name bridge0 type bridge vlan_filtering 1 vlan_default_pvid 0
ip link set dev ens192 master bridge0
ip link set bridge0 up
bridge vlan add vid 1 dev bridge0 pvid untagged self
bridge vlan add vid 2-4094 dev ens192
bridge vlan add vid 1 dev ens192 pvid
ip addr add 10.200.200.106/24 dev bridge0
ip route add default via 10.200.200.10
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master bridge0 state UP group default qlen 1000
link/ether 00:0c:29:44:89:b3 brd ff:ff:ff:ff:ff:ff
altname enp11s0
6: bridge0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:0c:29:44:89:b3 brd ff:ff:ff:ff:ff:ff
inet 10.200.200.106/24 scope global bridge0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe44:89b3/64 scope link
valid_lft forever preferred_lft forever
# bridge -compressvlans vlan show
port vlan-id
ens192 1 PVID
2-4094
bridge0 1 PVID Egress Untagged