Solution for dnsmasq + libvirt -- NS7-final

Hi, I’m facing a problem with those two, dnsmasq starts first then libvirt can’t start its instance of dnsmasq (due to bind problem to the same addres as main dnsmasq) to provide addreses for virtualmachines behind virtual nat. Only if I add:
bind-interfaces
interface=br0
everything starts.
It seems like the “main” dnsmasq doesn’t respect the:
except-interface=virbr0
Is it a bug or I’m missing something?
Thanks for any help. Cheers.

DNSmasq shouldn’t listen on virbr0 bridge, check with:

config show dnsmasq

You can change the configuration with these commands:

config setprop dnsmasq except-interface virbr0,virbr1
signal-event nethserver-dnsmasq-update

Sorry, but this feature is not documented :frowning:

Thanks, for You reply, but if i remove my “fix” libvirtd dnsmasq doesn’t start:

internal error: Child process (VIR_BRIDGE_NAME=virbr0 /sbin/dnsmasq --conf-file=/var/lib/l…atus 2:
dnsmasq: failed to bind DHCP server socket: Address already in use

In my dnsmasq config i have already:
except-interface=virbr0
but as I pointed in post above:

It seems like the “main” dnsmasq doesn’t respect the:
except-interface=virbr0

So I’m confused with that. Thanks for help so far.

Edit:
As I understand DNSmasq documentation except-interface prevents DNSmasq from listening on specified interface but not from bindin to it do is needed to specify:
bind-interfaces
interface=
Am I wrong?

No, probably you’re right but I can’t find a clear statement inside the manual.

We removed the bind-interfaces option because there were some side effects:

You could try this:
mkdir -p /etc/e-smith/templates-custom/etc/dnsmasq.conf/ echo "bind-interfaces" >> /etc/e-smith/templates-custom/etc/dnsmasq.conf/90bind signal-event nethserver-dnsmasq-update

Thank You for explanation, and sory that i didn’t pointed that I’ve already created:
/etc/e-smith/templates-custom/etc/dnsmasq.conf
with only bind-interfaces in this file shorewall doesn’t start, or is there a diference between my template and Yours?
My is:
bind-interfaces
interface=br0

but would be great if there’s a more “good looking” fix :wink: without those side effects.
Will You conssider a better solution for that?
Also we must conssider that this fix is proposed on libvirtd website:
https://wiki.libvirt.org/page/Libvirtd_and_dnsmasq

Edit:
Is seems it works in this way:
default: bind wildcard 0.0.0.0 and all interfaces (allow dynamic interfaces, not work with multiple dnsmasq)
bind-interfaces bind individual interfaces only if specified e.g interface=eth0 (not work with dynamic interfaces, work with multiple dnsmasq)
bind-dynamic binds individual interfaces even if the appear dynamicaly( allow dynamic interfaces, work with multiple dnsmasq)
so we should use:
bind-dynamic if available then DNSmaskq and libvirt:DNSmasq starts at boot properly - it seems it’s working for now. I think it’s worth to test.

It seems exactly what we are looking for! :wink:

Added to todo list: NethServer 7 · GitHub