How to get network working in virt-manager qemu vm?

I setup virt-manager some years ago, and i don’t remember networking being much of a problem to get running although I don’t remember exactly how I did it then…

But now, i’m trying to set it up again (fresh install of virt-manager and new vm), and I just cannot get it working.

What I tried was using the default nat network connection provided by virt-manager, turning it on, configuring the vm to use it and turning the vm on, but in the VM I don’t get any internet, and perhaps quite damningly, in the virt-manager ui it says ‘ip address: unknown’.

I tried with both virtio and hypervisor default models, and I tried changing the bridge from “any physical device” to wlan0 (my wireless network device) to open up a bridge directly to a physical card but neither seems to want to work. Am I doing something wrong? missing a step maybe?

The arch wiki said something about configuring /etc/qemu/bridge.conf and, well, that file didn’t exist (not in /usr/share/qemu either) but I created it and added an ‘allow virbr0’ line, it didn’t seem to change anything.

Have you ran this command? It autostarts the “default” network that is used for virtual machines with virt-manager.

sudo virsh net-autostart default

Then reboot.

I think i figured it out, mullvad vpn is getting in the way somehow.

It might be the killswitch feature (which cannot be disabled it seems).

If I turn off the vpn the internet in the vm works fine.

Now I wonder how to circumvent this without actually turning off the vpn, or maybe even getting the machine to connect to the vpn instead.

Edit: Enabling local network sharing is one way
image
But I’m not a big fan of that route, since i’m often not on my own home network.