You are not logged in.

#1 2022-01-17 05:16:21

effraie
Member
Registered: 2012-08-30
Posts: 66

Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

I just reinstalled Arch, and after booting my windows 10 wm (working correctly on my previous install), it cant connect to network

i use libvirt, QUEMU/KVM, and virt-manager, the WM boot correctly, and when trying to connect, windows return me that error : "Ethernet 2 doesn't have a valid IP configuration"

i suspect the issue being with NAT configuration to provide DHCP to guests, but i can't figure out how to fix that.

Any help welcome

Last edited by effraie (2022-01-19 00:11:58)

Offline

#2 2022-01-18 02:24:28

effraie
Member
Registered: 2012-08-30
Posts: 66

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

After some tinkering, i've not make many progress, but i can probably give more details on the situation :

* on a freshly installed arch (pretty minimal), i installed libvirt and virt-manager
* Then i created a "new" virtual machine, using a  QUEMU cow2 win10 image from my previous installation, using the "default" NAT network method
* The wm boot correctly, except i can't connect to internet, and get a basic "Ethernet does not have a valid IP configuration" in win10, with not much more information. Diagnostic tool doesn't give me more

I tried to look into the default network configuration, but everything look correct to me (a libvirt debutant)

here are some outputs that may be helpfull :

root in /home/mathieu 
❯ ip link show type bridge  
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:d3:28:a6 brd ff:ff:ff:ff:ff:ff
root in /home/mathieu 
❯ brctl show                
bridge name	bridge id		STP enabled	interfaces
virbr0		8000.525400d328a6	yes	
mathieu@radium ~ 
❯ sudo virsh net-dhcp-leases default
 Expiry Time   adresse MAC   Protocol   IP address   Hostname   Client ID or DUID
-----------------------------------------------------------------------------------
mathieu@radium ~ 
❯ sudo virsh net-info default                     
Nom :          default
UUID :         54b27d6e-6d0e-4aba-87d5-d9bf463d8e78
Actif :        Oui
Persistent:     Oui
Démarrage automatique : Oui
Bridge:         virbr0

Last edited by effraie (2022-01-18 02:49:43)

Offline

#3 2022-01-18 02:48:24

effraie
Member
Registered: 2012-08-30
Posts: 66

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

a quick try to install some linux distro (debian in that case) show me that the default network doesn't work better here. The installation program fail to retrieve an IP via DHCP

Offline

#4 2022-01-18 21:07:12

effraie
Member
Registered: 2012-08-30
Posts: 66

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

still working on this, hopefully someone will be able to help me.
I'm pretty sure the issue is with the "NO CARRIER" in the vibr0 section, but i can't figure out how to fix this :

mathieu@radium ~ 
❯ ip addr       
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: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether d0:c6:37:7d:c0:80 brd ff:ff:ff:ff:ff:ff
    altname wlp0s20f3
    inet 192.168.86.5/24 brd 192.168.86.255 scope global dynamic noprefixroute wlo1
       valid_lft 65562sec preferred_lft 65562sec
    inet6 fe80::3f96:7195:8901:56f8/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:d3:28:a6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever

Last edited by effraie (2022-01-18 21:08:06)

Offline

#5 2022-01-18 21:52:50

effraie
Member
Registered: 2012-08-30
Posts: 66

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

dnsmasq seem to fail to start

mathieu@radium ~ took 4s 
❯ systemctl status dnsmasq.service      
× dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
     Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Tue 2022-01-18 16:50:46 EST; 9s ago
       Docs: man:dnsmasq(8)
    Process: 27033 ExecStartPre=/usr/bin/dnsmasq --test (code=exited, status=0/SUCCESS)
    Process: 27034 ExecStart=/usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file (code=exited, status=2)
   Main PID: 27034 (code=exited, status=2)
        CPU: 23ms

jan 18 16:50:46 radium systemd[1]: dnsmasq.service: Scheduled restart job, restart counter is at 5.
jan 18 16:50:46 radium systemd[1]: Stopped dnsmasq - A lightweight DHCP and caching DNS server.
jan 18 16:50:46 radium systemd[1]: dnsmasq.service: Start request repeated too quickly.
jan 18 16:50:46 radium systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
jan 18 16:50:46 radium systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
zsh: exit 3     systemctl status dnsmasq.service
mathieu@radium ~ 

Offline

#6 2022-01-22 23:35:54

effraie
Member
Registered: 2012-08-30
Posts: 66

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

i just tried a fresh install, and have the exact same issue

Offline

#7 2022-01-23 11:28:10

-thc
Member
Registered: 2017-03-15
Posts: 697

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

[There was - for a short time - some non-helpful stuff here.]

I visited the QEMU section of the ArchWiki and realized I am completely out of my depth here. Providing DHCP addresses to the guests is QEMUs job (built-in DHCP-Server). dnsmasq seems to be used for "host-only" networking,

Last edited by -thc (2022-01-23 11:51:33)

Offline

#8 2022-01-23 12:28:44

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,945

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

The problem could be in the brdige setup , libvirt , your host network management .

Which method did you use to setup the network bridge ?

How do you manage the network on the host ?

Last edited by Lone_Wolf (2022-01-23 12:30:31)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#9 2022-01-23 13:30:39

huntermint
Member
Registered: 2022-01-17
Posts: 15

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

effraie wrote:

i just tried a fresh install, and have the exact same issue

same issue with me. My laptop use wifi internet, I try to install Androidx86, after success, I try to log in Google play, but the network offline, wifi can't start on Androidx86

On virt-manager Ip address not found
https://i.imgur.com/jH5AdJs.png

Offline

#10 2022-01-23 13:33:31

huntermint
Member
Registered: 2022-01-17
Posts: 15

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

Lone_Wolf wrote:

The problem could be in the brdige setup , libvirt , your host network management .

Which method did you use to setup the network bridge ?

How do you manage the network on the host ?

I follow this method:
https://wiki.archlinux.org/title/Libvirt#Server
iptables-nft, dnsmasq and dmidecode for the default NAT/DHCP networking.
same not working

dnsmasq inactive
https://i.imgur.com/nqCvYuf.png

Last edited by huntermint (2022-01-23 23:10:38)

Offline

#11 2022-01-23 17:21:28

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,945

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

The libvirt server section mentions bridge-utils but no instructions .

for clarity : did you follow https://wiki.archlinux.org/title/Networ … idge-utils ?

iptables-nft, dnsmasq and dmidecode for the default NAT/DHCP networking.

Those are used by libvirt to provide network to clients .

What are you using to manage network on the host ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#12 2022-01-23 23:13:51

huntermint
Member
Registered: 2022-01-17
Posts: 15

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

Lone_Wolf wrote:

The libvirt server section mentions bridge-utils but no instructions .

for clarity : did you follow https://wiki.archlinux.org/title/Networ … idge-utils ?

iptables-nft, dnsmasq and dmidecode for the default NAT/DHCP networking.

Those are used by libvirt to provide network to clients .

What are you using to manage network on the host ?

I haven't used the bridge-utils way at this point.

On host I use internet wifi with automatic dhcp

Last edited by huntermint (2022-01-23 23:14:26)

Offline

#13 2022-01-24 10:55:49

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,945

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

Huntermind, atm there's not enough info to determine if you have the same issue as effraie.

I suggest you start a new thread.

In your opening post you need to clarify which of the tools listed at https://wiki.archlinux.org/title/Networ … management you use to manage the network connections on the host.

Also add the outputs of

$ ip link
$ ip address
$ ip -6 route
$ ip -4 route

on the host .

@effraie
please read https://wiki.archlinux.org/title/Network_bridge and inform us which of the methods listed you have used to setup the network bridge.
Also mention what network managment tool you use on the host.

Last edited by Lone_Wolf (2022-01-24 10:56:40)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#14 2022-01-24 13:03:30

Arrowhead
Member
Registered: 2021-11-27
Posts: 7

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

Do we need to setup the network bridge, though?
The wiki page says that we need it for "bridge mode of QEMU", but effraie uses default NAT.
I'm also trying to make the default NAT/DHCP work on a guest, and I'm currently facing the same problem.
Interestingly, the wiki says the following:

iptables-nft, dnsmasq and dmidecode for the default NAT/DHCP networking.

In my case `dnsmasq` is not running, and it seems that DNS is handled by `systemd-resolved` (and it also occupies port 53 preventing `dnsmasq` from starting).
Could this be a problem? I'm using NetworkManager for networking on the host.

Offline

#15 2022-01-24 13:18:25

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,945

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

about dnsmasq :
libvirt sets up a virtual network in which dnsmasq takes care of dns resolution in that virtual network, not for the network on the host.
leave starting/stopping dnsmasq to libvirt .

The default networking libivrt uses requires a network bridge, see https://wiki.libvirt.org/page/VirtualNe … figuration

That bridge needs to be setup on the host before libvirt can use it, and the bridge needs to be setup to work with whatever network management tool the host uses.

For bridges with NetworkManager see https://wiki.archlinux.org/title/Networ … orkManager

Last edited by Lone_Wolf (2022-01-24 13:19:06)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#16 2022-01-24 15:33:01

Arrowhead
Member
Registered: 2021-11-27
Posts: 7

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

@Lone_Wolf:
I tried creating a new bridge using `nmcli`. It seems that I ended up with mostly the same bridge as the one created (automatically?) when the "default" network is activated in KVM/QEMU settings. In particular, the `ip a` output for the bridges looks like this:

$ ip a
5: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether d2:72:60:97:bc:08 brd ff:ff:ff:ff:ff:ff
    inet 192.168.77.1/24 scope global br0
       valid_lft forever preferred_lft forever
6: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:69:af:06 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever

What I don't get is why it's "DOWN". Is it supposed to be "DOWN" even when the VM is running? It is always in this state in my case, and I cannot change it to "UP" with "ip link set".

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 38:14:47:50:C7:94 brd ff:ff:ff:ff:ff:ff
5: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether d2:72:60:97:bc:08 brd ff:ff:ff:ff:ff:ff
11: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:69:af:06 brd ff:ff:ff:ff:ff:ff

I also tried deactivating the main "enp34s0" and activating the bridge as instructed and then selecting it for QEMU use, but surprisingly, I still couldn't get networking on a guest.

$ 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: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
    link/ether 38:14:47:50:C7:94 brd ff:ff:ff:ff:ff:ff
5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether d2:72:60:97:bc:08 brd ff:ff:ff:ff:ff:ff
    inet 192.168.77.1/24 scope global br0
       valid_lft forever preferred_lft forever
    inet 192.168.0.102/24 brd 192.168.0.255 scope global dynamic noprefixroute br0
       valid_lft 6852sec preferred_lft 6852sec
    inet6 fe80::a2a:f59:d656:7e6e/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
12: virbr1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:78:88:35 brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.1/24 brd 192.168.100.255 scope global virbr1
       valid_lft forever preferred_lft forever
13: vnet3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether fe:54:00:41:e1:4d brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc54:ff:fe41:e14d/64 scope link 
       valid_lft forever preferred_lft forever

As I understand it, the `virbr1` is the interface that's supposed to provide network in VM (it only appears when VM is running), but it's still "DOWN".

Offline

#17 2022-01-27 00:29:29

effraie
Member
Registered: 2012-08-30
Posts: 66

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

sorry for my lack of participation : needing the VM to run quickly for work, i had to switch back to my debian setup for the moment

Offline

#18 2022-01-27 17:01:38

wildbb
Member
Registered: 2022-01-27
Posts: 5

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

I just stumble upon what seems to be a really near configuration and get somewhat the same problem. I mean by it that virt-manager stopped functioning as soon as I started to setup my PC somehow as a router with dnsmasq as a nameserver for DNS caching.
 
When running the command:

virsh net-start --network default

I was getting error:

error: Unable to start default network
error :internal error: Child process (VIR_BRIDGE_NAME=virbr0 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper) unexpected exit status 2:
dnsmasq: failed to bind DHCP server socket: Address already in use

Uncommenting in /etc/dnsmasq.conf the option "bind-interfaces" seems to resolve the problem. The comment being that this options is only ever wanted when a PC as two names servers is it possible that it is aimed at virtual machines ?

Hope it can help,

Offline

#19 2022-01-27 18:39:44

Arrowhead
Member
Registered: 2021-11-27
Posts: 7

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

@wildbb, I tried your suggestion, but no luck. In my case, the situation is more subtle as I don't see any explicit errors. It all seems fine except that the network doesn't work smile

@effraie, thanks for the update!

So far I tried several things:

  • rolled back to libvirtd 7.9

  • rolled back to qemu 6.1

  • different LiveCD: Fedora KDE instead of Debian MATE

  • different devices in virtual machine manager

With all those changes the symptoms remain the same.

One of the tutorials suggested that iptables might need additional configuration, but on my system it's already fine:

$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

I also enabled logging for `libvirtd.log`, `virtnetworkd.log`, `virtqemud.log`, but I don't see anything incriminating there.

One interesting thing that I noticed is that `virbr0` is not accompanied by `virbr0-nic`:

# brctl show
bridge name	bridge id		STP enabled	interfaces
virbr0		8000.52540069af06	yes

This answer suggests that older versions didn't add it, but our version (8.0 released just weeks ago) cannot possibly be considered "old". Can someone with a working NAT network check if they have a virtual interface for a bridge?

I also tried assigning IPs manually since the XML configuration clearly states what it's going to assign as part of DHCP:

<network connections="1">
  <name>default</name>
  <uuid>b45afa7b-dd6d-48fb-b655-32057b3882a7</uuid>
  <forward mode="nat">
    <nat>
      <port start="1024" end="65535"/>
    </nat>
  </forward>
  <bridge name="virbr0" stp="on" delay="0"/>
  <mac address="52:54:00:69:af:06"/>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254"/>
    </dhcp>
  </ip>
</network>

However, even assigning "192.168.122.2" manually inside the VM doesn't help and the gateway is marked as "incomplete":

$ ip neigh
192.168.122.1 dev  enp8s0   INCOMPLETE

Is there a way to check that a request from VM reaches the bridge?

Offline

#20 2022-01-27 18:40:42

wildbb
Member
Registered: 2022-01-27
Posts: 5

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

Update, I mislead myself. I was able to get virbr0 active but actually I lost my nameserver on physical network and no DHCP server nor naming server as you guest for the virtual network.

I also get every time I try to restart dnsmasq:

janv. 27 19:24:59 ghstsrvr systemd[1]: dnsmasq.service: Start request repeated too quickly.
janv. 27 19:24:59 ghstsrvr systemd[1]: dnsmasq.service: Failed with result 'exit-code'.

One thing I noted is that stopping default virtual interface with

 virsh net-destroy --network default 

do not stop this message, but flushing nft tables and resetting to a fresh state does.

Offline

#21 2022-01-27 20:34:37

wildbb
Member
Registered: 2022-01-27
Posts: 5

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

Ok I think have found something, but things get a bit convoluted.

I find out that virtnetworkd.service (and affiliates) seems to have an influence on firewall tables. Just a guest as I had to play with it to recreate the virtual network interface and what is sure is that the virtual network interface will turn on only if a set of iptables/nftables are present. This modifications seems to prevent dnsmasq from starting. I didn't found which part of this modified nftables tables prevent dnsmasq from working so nothing sure.

I did find a way to make windows functional in the virt-manager but as said it is convoluted.

To enable the creation of the virtual network I had to stop dnsmasq. If needed restart virtnetworkd.service and affiliate. When starting the virtual interface with:

virsh net-start --network default

you should see these modifications (or maybe equivalent ones on iptables). The thing I did is keep track of the nft tables dynamically created by virsh and then flush all the tables with:

nft flush ruleset

I then started dnsmasq and restored the nft tables I previously flushed.

In the different tests I made, I couldn't list in dnsmasq.conf virbr0 as an interface to listen (I could for the physical one). I could list localhost pool and physical interface pool but not the virbr0's pool of ipv4 addresses to listen. Also I have once again bind-addresses option uncommented.

Also in windows I was forced to manually set the ip address, gateway and dns server addresses but finally the connection worked.

This is really messy but it worked (at least once). The impression I get from it is that virsh is not able in the current state to handle dynamic changes of the network when dnsmasq and a firewall setup for a router are implied.

Note:

192.168.122.1/24 is the pool of addresses for my virtual network.

What I get if I try to start dnsmasq with option listen=virbr0:

janv. 27 20:31:47 ghstsrvr dnsmasq[9759]: dnsmasq: vérification de syntaxe OK. // syntax verification OK
janv. 27 20:31:47 ghstsrvr dnsmasq[9761]: dnsmasq: impossible to create a listening socket for 192.168.122.1 : Address already used.
janv. 27 20:31:47 ghstsrvr dnsmasq[9761]: impossible de créer une socket d'écoute pour 192.168.122.1 : Adresse déjà utilisée // same as previous line actually
janv. 27 20:31:47 ghstsrvr dnsmasq[9761]: IMPOSSIBLE de démarrer // IMPOSSIBLE to start
janv. 27 20:31:47 ghstsrvr systemd[1]: dnsmasq.service: Main process exited, code=e

At this point I tried to suppress the address manually with:

ip addr delete 192.168.122.1/24 dev virbr0

in hope it will give dnsmasq service the possibility to get control over virbr0 but I get the error:

janv. 27 20:32:01 ghstsrvr dnsmasq[9767]: dnsmasq: vérification de syntaxe OK. // syntax verification OK
janv. 27 20:32:01 ghstsrvr dnsmasq[9768]: dnsmasq: impossible to create a listening socket for 192.168.122.1 : Can not assign asked address
janv. 27 20:32:01 ghstsrvr dnsmasq[9768]: impossible de créer une socket d'écoute pour 192.168.122.1 : Ne peut attribuer l'adresse demandée // same as previous line
janv. 27 20:32:01 ghstsrvr dnsmasq[9768]: IMPOSSIBLE de démarrer // ... I suppose you guest
janv. 27 20:32:01 ghstsrvr systemd[1]: dnsmasq.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

Offline

#22 2022-01-27 22:41:49

Toolybird
Member
Registered: 2017-09-30
Posts: 76

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

Folks, there appears to be a fair amount of confusion in this thread. I'd really like to understand what's going on here, because if there is a problem in the Arch config and/or docs, it needs to be fixed. For most people (including me) the basic Virtual Network (NAT) setup works out of the box.

1. If you're starting/enabling dnsmasq service manually, you're doing it wrong. Please don't do this! Libvirt runs its own dnsmasq instance when it needs to.

2. If you're manually trying to configure a bridge on the host, you're doing it wrong. Again, please don't do this. Libvirt will create "virbr0" for you.

There is a potential problem I'm looking into and it relates to the startup of the libvirtd daemon. I've submitted a fix to the Arch bug tracker but I'm not sure if it will solve the problems in this thread or not.

For reference, this is what happens on my working system.

Virtual Network started but no VMs running:

3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:5e:04:5f brd ff:ff:ff:ff:ff:ff

Virtual Network started and a VM is now running:

3: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:5e:04:5f brd ff:ff:ff:ff:ff:ff
5: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master virbr0 state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether fe:54:00:21:7e:d7 brd ff:ff:ff:ff:ff:ff

Offline

#23 2022-01-28 03:28:56

Arrowhead
Member
Registered: 2021-11-27
Posts: 7

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

@Toolybird: Thanks for clarification!

I'm not running `dnsmasq` manually and I'm using the bridge that was configured automatically. Also, the output for `ip link` looks almost identical (vnet1 vs vnet2) on my machine. The only difference is that it doesn't work out of the box smile

Your fix looks promising, but if the problem was only limited to version 8.0 of libvirtd, would it go away when I rolled back to version 7.9? Because this is what I tried, and it didn't help.

Offline

#24 2022-01-28 05:22:44

Toolybird
Member
Registered: 2017-09-30
Posts: 76

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

> Your fix looks promising, but if the problem was only limited to version 8.0 of libvirtd, would it go away when I rolled back to version 7.9?

No. The bug I'm trying to fix is almost 6 years old smile

Anyway, a new libvirt pkg with latest fixes has hit community-testing. Please give it a test (manual download and install with pacman -U ... will work)

I'd also be keen to see the output of:

systemctl status libvirtd

Last edited by Toolybird (2022-01-28 05:56:55)

Offline

#25 2022-01-28 12:05:28

Arrowhead
Member
Registered: 2021-11-27
Posts: 7

Re: Libvirt, dnsmasq, QUEMU/KVM : default network dhcp not working

I downloaded the latest "1:8.0.0-2" package from the mirror, installed it with `pacman -U` and restarted `libvirtd.service`. The VM loads but still doesn't have network.

The status looks like this:

● libvirtd.service - Virtualization daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled)
     Active: active (running) since Fri 2022-01-28 14:54:50 MSK; 7s ago
TriggeredBy: ● libvirtd.socket
             ● libvirtd-ro.socket
             ● libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
   Main PID: 2622 (libvirtd)
      Tasks: 21 (limit: 32768)
     Memory: 46.7M
        CPU: 355ms
     CGroup: /system.slice/libvirtd.service
             ├─ 865 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
             ├─ 866 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
             └─2622 /usr/bin/libvirtd --timeout 120

Jan 28 14:54:50 astoria systemd[1]: Starting Virtualization daemon...
Jan 28 14:54:50 astoria libvirtd[2622]: 2022-01-28 11:54:50.089+0000: 2622: info : libvirt version: 8.0.0
Jan 28 14:54:50 astoria libvirtd[2622]: 2022-01-28 11:54:50.089+0000: 2622: info : hostname: astoria
Jan 28 14:54:50 astoria libvirtd[2622]: 2022-01-28 11:54:50.089+0000: 2622: debug : virLogParseOutputs:1635 : outputs=3:file:/var/log/libvirt/libvirtd.log
Jan 28 14:54:50 astoria libvirtd[2622]: 2022-01-28 11:54:50.089+0000: 2622: debug : virLogParseOutput:1482 : output=3:file:/var/log/libvirt/libvirtd.log
Jan 28 14:54:50 astoria systemd[1]: Started Virtualization daemon.
Jan 28 14:54:50 astoria dnsmasq[865]: read /etc/hosts - 9 addresses
Jan 28 14:54:50 astoria dnsmasq[865]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Jan 28 14:54:50 astoria dnsmasq-dhcp[865]: read /var/lib/libvirt/dnsmasq/default.hostsfile

Offline

Board footer

Powered by FluxBB