[libvirt-users] dnsmasq does not start

Laine Stump laine at laine.org
Wed Apr 24 16:00:00 UTC 2013


On 04/24/2013 03:23 AM, Alexey Kardashevskiy wrote:
> Hi!
>
> I am trying to run tap networking with libvirtd.
>
> My test system is Fedora18/ppc64, libvirt 1.0.4 (compiled from git and
> installed). On another system with Fedora17/ppc64 with the same
> settings, dnsmasq is running. All configs in /etc/libvirt/ are default
> and not changed, the only exception is
> /etc/libvirt/qemu/networks/default.xml which I copied from
> Fedora17/ppc64 setup.
>
> What does exactly force libvirtd to start dnsmasq?

libvirtd starts an instance of dnsmasq for each virtual network that is
started (unless the network has no <ip> elements).

Normally, the network named "default" is preinstalled to be an
"autostarted" network. Internally this is implemented by making a
symbolic link from /etc/libvirt/qemu/networks/autostart/${netname}.xml
to /etc/libvirt/qemu/networks/${netname}.xml. I'm guessing that this was
never setup when you installed libvirt.

You shouldn't set autostart by creating this link yourself, though.
Instead, run the following commands to set the default network as
autostart and then start it:


   virsh net-autostart default
   virsh net-start default

The first command makes sure it will be autostarted in the future
whenever libvirtd is restarted, and the 2nd starts it manually this one
time.

(But before you do this, read below - you've done something else wrong
when you manually copied the config file into /etc/libvirt, and I have a
complete list of the commands you should run to fix *everything*)

>
>
> Some debug info:
>
> [root at vpl2 ~]# ps ax | egrep \(dnsmasq\|libvirt\)
>  9021 ?        Ssl    0:00 /usr/sbin/libvirtd
>  9271 pts/0    S+     0:00 egrep --color=auto (dnsmasq|libvirt)
> [root at vpl2 ~]#
> [root at vpl2 ~]# cat /etc/libvirt/qemu/networks/default.xml
> <network>
>   <name>default</name>
>   <bridge name="virbr%d" />

This line ^^^^ is unnecessary.

However, I see that this network is *missing* a <uuid> element. This
tells me that you just copied the file into place manually rather than
using the approved API for defining a network. See below for the
commands to fix everything...


>   <forward/>


So you've modified it to be an isolated network. (you could also have
just completely removed the <forward/> element). This means your guests
will not be able to reach anything beyond the virtualization host
itself. Is that really what you wanted? If not, that line must instead
be <forward mode='nat'/>


>   <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>


To fix all of your problems, you should do the following:

1) service libvirtd stop
2) mv /etc/libvirt/qemu/networks/default.xml /tmp
3) [edit /tmp/default.xml and remove the <bridge name='.... line ]
4) service libvirtd start
5) virsh net-define /tmp/default.xml
6) virsh net-autostart default
7) virsh net-start default


> [root at vpl2 ~]#
> [root at vpl2 ~]# service libvirtd restart
> Redirecting to /bin/systemctl restart  libvirtd.service
> [root at vpl2 ~]#
> [root at vpl2 ~]#
> [root at vpl2 ~]# ps ax | egrep \(dnsmasq\|libvirt\)
>  9365 ?        Ssl    0:00 /usr/sbin/libvirtd
>  9507 pts/0    S+     0:00 egrep --color=auto (dnsmasq|libvirt)
> [root at vpl2 ~]#
> [root at vpl2 ~]# ls -laR /var/log/libvirt/
> /var/log/libvirt/:
> total 20
> drwx------.  5 root root 4096 Apr  9 16:51 .
> drwxr-xr-x. 18 root root 4096 Apr 24 13:48 ..
> drwx------.  2 root root 4096 Apr  9 16:51 lxc
> drwx------.  2 root root 4096 Apr 24 17:22 qemu
> drwx------.  2 root root 4096 Apr  9 16:51 uml
>
> /var/log/libvirt/lxc:
> total 8
> drwx------. 2 root root 4096 Apr  9 16:51 .
> drwx------. 5 root root 4096 Apr  9 16:51 ..
>
> /var/log/libvirt/qemu:
> total 8
> drwx------. 2 root root 4096 Apr 24 17:22 .
> drwx------. 5 root root 4096 Apr  9 16:51 ..
>
> /var/log/libvirt/uml:
> total 8
> drwx------. 2 root root 4096 Apr  9 16:51 .
> drwx------. 5 root root 4096 Apr  9 16:51 ..
> [root at vpl2 ~]#
>
>




More information about the libvirt-users mailing list