When libvirt would start dnsmasq?
Hi guys. Under what circumstances libvrirt would start _dnsmasq_ on it's own? I certainly did not plan for libvirt to manage dhcp but sometimes I find: -> $ netstat -utapn | grep \:67 udp 0 0 0.0.0.0:67 0.0.0.0:* 19678/dnsmasq -> $ ps -Fp 19678 UID PID PPID C SZ RSS PSR STIME TTY TIME CMD dnsmasq 19678 1 0 2258 1824 8 Oct07 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper which... does fcuk up my main (should be the only) DHCP server. Is it possible to tell libvirt not to do that no matter the circumstances? (or it's not libvirt?) many thanks, L.
On Thu, Oct 08, 2026 at 06:59:42 +0200, lejeczek via Users wrote:
Hi guys.
Under what circumstances libvrirt would start _dnsmasq_ on it's own?
Libvirt starts a dnsmasq instance when you have a libvirt-managed network which is configured to provide addresses via DHCP or DNS forwarding.
I certainly did not plan for libvirt to manage dhcp but sometimes I find:
-> $ netstat -utapn | grep \:67 udp 0 0 0.0.0.0:67 0.0.0.0:* 19678/dnsmasq
-> $ ps -Fp 19678 UID PID PPID C SZ RSS PSR STIME TTY TIME CMD dnsmasq 19678 1 0 2258 1824 8 Oct07 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
which... does fcuk up my main (should be the only) DHCP server. Is it possible to tell libvirt not to do that no matter the circumstances? (or it's not libvirt?)
You need to disable 'DNS' and 'DHCP' addressing for all networks you have defined in libvirt or disable them (disable autostart).
On Thu, Oct 08, 2026 at 11:15:16AM +0200, Peter Krempa via Users wrote:
On Thu, Oct 08, 2026 at 06:59:42 +0200, lejeczek via Users wrote:
Hi guys.
Under what circumstances libvrirt would start _dnsmasq_ on it's own?
Libvirt starts a dnsmasq instance when you have a libvirt-managed network which is configured to provide addresses via DHCP or DNS forwarding.
I certainly did not plan for libvirt to manage dhcp but sometimes I find:
-> $ netstat -utapn | grep \:67 udp 0 0 0.0.0.0:67 0.0.0.0:* 19678/dnsmasq
-> $ ps -Fp 19678 UID PID PPID C SZ RSS PSR STIME TTY TIME CMD dnsmasq 19678 1 0 2258 1824 8 Oct07 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
which... does fcuk up my main (should be the only) DHCP server. Is it possible to tell libvirt not to do that no matter the circumstances? (or it's not libvirt?)
You need to disable 'DNS' and 'DHCP' addressing for all networks you have defined in libvirt or disable them (disable autostart).
Or configure your own dnsmasq to only operate on certain interfaces. Libvirt's dnsmasq are all configured to explicitly only touch the network interface (bridge) that libvirt created, so it can co-exist with other dnsmasqs that are servicing other interfaces https://wiki.libvirt.org/Libvirtd_and_dnsmasq.html With regards, Daniel -- |: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
I've completely forgotten about 'default' network which I've never used. But what is pretty confusing to me are the circumstances under which "it" happens, namely... There are no guests using 'default' network - there is DHCP server on "physical" network (same host as libvirt) I can confirm dnsmasq is not started, is not running, not on boot nor later, then... "main" DHCP server goes down for whatever reason and... this happens, libvirt/dnsmasq slaps itself onto main/all network & actual DHCP is unable to come back - for obvious reason - when it does. Why would libvirt/dnsmasq (mis)behave like that? I've now disabled 'default' net's autostart but... jee. thanks, L.
On Thu, Oct 08, 2026 at 03:12:44PM +0200, lejeczek via Users wrote:
I've completely forgotten about 'default' network which I've never used.
But what is pretty confusing to me are the circumstances under which "it" happens, namely... There are no guests using 'default' network - there is DHCP server on "physical" network (same host as libvirt)
If its config is installed, the default network is set to autostart when virtnetworkd or libvirtd is started. Ideally modern deployments use modular daemons instead of libvirtd, such that virnetworkd is only launched when a guest actually wants to use a virtual network.
I can confirm dnsmasq is not started, is not running, not on boot nor later, then... "main" DHCP server goes down for whatever reason and... this happens, libvirt/dnsmasq slaps itself onto main/all network & actual DHCP is unable to come back - for obvious reason - when it does.
Libvirt does not do that. Any dnsmasq libvirt launches is configured to *only* operate on the specific bridge device libvirt creates. It leaves all other NICs alone for the user to configure their own DHCP/DNS service against. With regards, Daniel -- |: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
participants (3)
-
Daniel P. Berrangé -
lejeczek -
Peter Krempa