我正在使用 libvirt 和 kvm/qemu 运行 centos 8 作为 virt-host。网络设置为使用 virbr0 的桥接模式。突然一夜之间,它停止工作:客户端不再连接,如果我尝试在虚拟机管理器中连接网络,我会得到“Bridge virbr0:Empty Bridge”,甚至在启动任何客户端之前就会出现这种情况。
[root@labpc1 log]# ifconfig
enp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.8 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 2003:c0:3713:3000:fa5b:356b:c6a6:18ff prefixlen 64 scopeid 0x0<global>
inet6 fe80::9b26:4d1a:f92c:c21c prefixlen 64 scopeid 0x20<link>
ether 34:97:f6:8e:c0:73 txqueuelen 1000 (Ethernet)
RX packets 4788 bytes 482052 (470.7 KiB)
RX errors 0 dropped 912 overruns 0 frame 0
TX packets 2205 bytes 617635 (603.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
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.2.8 netmask 255.255.255.0 broadcast 192.168.2.255
ether de:a2:bd:89:f8:d4 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
/var/log/messages 中有以下消息:
grep virbr0 /var/log/messages
Jan 9 19:24:30 labpc1 NetworkManager[1051]: <info> [1578594270.5088] ifcfg-rh: new connection /etc/sysconfig/network-scripts/ifcfg-virbr0 (a2d02297-f0a1-4f1e-a5c4-ebd5d5e62c89,"virbr0")
Jan 9 19:24:30 labpc1 NetworkManager[1051]: <info> [1578594270.5092] ifcfg-rh: new connection /etc/sysconfig/network-scripts/ifcfg-virbr0_slave_1 (7b0e15aa-3c0c-44a6-802e-0a1af319a2e2,"virbr0 slave 1")
Jan 9 19:24:31 labpc1 NetworkManager[1051]: <info> [1578594271.2427] manager: (virbr0): new Bridge device (/org/freedesktop/NetworkManager/Devices/3)
Jan 9 19:24:31 labpc1 systemd-udevd[1340]: Could not generate persistent MAC address for virbr0: No such file or directory
Jan 9 19:24:31 labpc1 kernel: IPv6: ADDRCONF(NETDEV_UP): virbr0: link is not ready
Jan 9 19:24:31 labpc1 NetworkManager[1051]: <info> [1578594271.4417] device (virbr0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Jan 9 19:24:31 labpc1 NetworkManager[1051]: <info> [1578594271.4439] device (virbr0): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'managed')
Jan 9 19:24:31 labpc1 NetworkManager[1051]: <info> [1578594271.4449] policy: auto-activating connection 'virbr0' (a2d02297-f0a1-4f1e-a5c4-ebd5d5e62c89)
Jan 9 19:24:31 labpc1 NetworkManager[1051]: <info> [1578594271.4455] device (virbr0): Activation: starting connection 'virbr0' (a2d02297-f0a1-4f1e-a5c4-ebd5d5e62c89)
Jan 9 19:24:31 labpc1 NetworkManager[1051]: <info> [1578594271.4456] device (virbr0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Jan 9 19:24:31 labpc1 NetworkManager[1051]: <info> [1578594271.4543] device (virbr0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Jan 9 19:24:32 labpc1 NetworkManager[1051]: <info> [1578594272.7065] device (virbr0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Jan 9 19:24:32 labpc1 NetworkManager[1051]: <info> [1578594272.7077] device (virbr0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Jan 9 19:24:32 labpc1 kernel: IPv6: ADDRCONF(NETDEV_UP): virbr0: link is not ready
Jan 9 19:24:32 labpc1 avahi-daemon[932]: Joining mDNS multicast group on interface virbr0.IPv4 with address 192.168.2.8.
Jan 9 19:24:32 labpc1 NetworkManager[1051]: <info> [1578594272.7083] device (virbr0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Jan 9 19:24:32 labpc1 avahi-daemon[932]: New relevant interface virbr0.IPv4 for mDNS.
Jan 9 19:24:32 labpc1 NetworkManager[1051]: <info> [1578594272.7084] device (virbr0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Jan 9 19:24:32 labpc1 avahi-daemon[932]: Registering new address record for 192.168.2.8 on virbr0.IPv4.
Jan 9 19:24:32 labpc1 NetworkManager[1051]: <info> [1578594272.8032] policy: set 'virbr0' (virbr0) as default for IPv4 routing and DNS
Jan 9 19:24:32 labpc1 NetworkManager[1051]: <info> [1578594272.8863] device (virbr0): Activation: successful, device activated.
Jan 9 19:24:32 labpc1 nm-dispatcher[1121]: req:3 'up' [virbr0]: new request (3 scripts)
Jan 9 19:24:32 labpc1 nm-dispatcher[1121]: req:3 'up' [virbr0]: start running ordered scripts...
最具体地说,我缺少一条类似内核的消息:virbr0:端口 3(vnet1)进入转发状态
它过去一直正常工作,无需任何刻意的改变。
任何提示都将不胜感激
沃尔夫冈
答案1
在我第五次炸毁并铺平道路之后,我做了以下事情:
nmcli con show
nmcli con delete <all interfaces but the one i was connected to>
nmcli con add ifname br0 type bridge con-name br0
nmcli con add type bridge-slave ifname eno1 master br0
nmcli con up br0
然后我偷懒,用 nmtui 将静态 ips 添加到 br0,然后启动 libvirt……成功了……