KVM QEMU Virtual Machine Loses Network - requires Network NIC Toggle

Опубликовано: 22 Март 2025
на канале: ServerMatter
2,207
16

We have experienced this on a few of our servers. Thus far we don't know why it happens or how to prevent if from happening. If we have no Internet on a VM and reboot the VM, we still have no Internet. However, if we shut the VM down and toggle the network adapter to any other adapter, it works every time.

Thoughts....
1 Try to determine what time the network came offline.
2 Run grep "entered blocking state" /var/log/kern.log and note the time of the first time it appears.
Aug 5 08:42:28 servermatter kernel: [4658052.101543] br0: port 1(smnet1) entered blocking state
Aug 5 08:43:41 servermatter kernel: [4658124.713161] br0: port 1(smnet1) entered blocking state
Aug 5 08:44:28 servermatter kernel: [4658171.721226] br0: port 1(smnet1) entered blocking state
Aug 5 08:44:42 servermatter kernel: [4658186.073308] br0: port 1(smnet1) entered blocking state
.....
There's a relationship to the problem here. Haven't figured it out yet.

2023.11.12 Update Below
On the advice of one respondent I have change the following settings. The VM Internet did survive a few total shutdowns and startups. Will see if it stays the course ...

Instructions:
The naming of this tap as tap0 is arbitrary. You can call it anything you want ie; netTest or net0 or tapX. tap0 (and higher as you add more) is the industry norm.

Shutdown all VM's then carry out these commands

sudo ip tuntap add dev tap0 mode tap
sudo ip link set tap0 up
sudo chown libvirt-qemu /dev/net/tun
sudo brctl addif br0 tap0

Now set the NIC adapter on each VM to use the 'virtio' adapter

Start your VM's