Libvirt guest can't connect to Internet

I need some help setting up my Virtual Machines/Virtual Network

I recently installed Manjaro on my PC and wanted to get my HVM setup going that I had working on Arch before. After configuring the pci-passthrough everything worked fine except for connecting to the Internet via the default virtual network (even after installing dnsmasq, firewalld and ebtables)

I checked

sudo systemctl status libvirtd.service

but it says the service is active and there’s no error messages, no troubles initializing the networks whatsoever

brctl reports the bridge as existing and in general the virtual network seems to work (other than connecting to the internet)

20190129-234752_535x50_screenshot

my guest config is nothing fancy just a standard guest thrown together to test the connection (other methods like passing through the ethernet connection work)

    <interface type='network'>
      <mac address='52:54:00:f0:3d:d5'/>
      <source network='default'/>
      <model type='e1000'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

my iptables look like this:

my network configuration xml (the host bit was added by me as an attempted fix)

<network connections='1'>
  <name>default</name>
  <uuid>da88e18f-a966-469e-b1c6-1e6fd85201c1</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:6a:5b:0f'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
      <host mac='52:54:00:f0:3d:d5' name='user' ip='192.168.122.45'/>
    </dhcp>
  </ip>
</network>

any help or suggestions would be highly appreciated.

well this is awkward…

so I already gave up but tried one more search and stumbled upon this which at first didn’t seem to be related to my problem at all but the comment at the bottom was actually the solution to my problem

This is the error that comes up if libvirtd was started without ebtables and/or dnsmasq installed. If you’ve got them installed and you’re still having this issue, you probably need to restart the libvirtd service:

sudo systemctl restart libvirtd.service

Credit to the comments on the other answer to this question for illuminating this. I’m submitting it as a new and separate answer to the original question because installing and starting firewalld to solve the original problem is liable to cause new problems: once the firewall daemon is running, most of the services you’ll want within your virtual machine, including DHCP, will be blocked by default, meaning that your VMs will not be able to reach the network on initialization.

I lost over an hour of my life trying to track down this problem, and tracing it to a firewall I had just enabled was one of the dumbest sources of a bug that I’ve ever run into. Don’t let it take any time from yours.

little did he know my dumb ass spent days on this.

TL;DR uninstall firewalld if you installed it because you thought libvirt would need it
(also don’t start dnsmasq via systemctl if libvirt says port 53 is blocked, libvirt will initalize dnsmasq on it’s own)

1 Like