I was interested in trying to configure a local dnsmasq, but when I tried to start it, I found out there was already one running, using port 53.
I don't know who started it or why it's running, or if I really need it. ps auxwww | grep dns nobody 1052 0.0 0.0 51124 1100 ? S Nov04 0:00 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile- ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
Clearly has something to do with libvirt, probably I did some experiment a long time back that required it. But just removing libvirt-daemon is not an option, that would remove a lot of stuff.
On Mon, 07 Nov 2016 13:23:21 -0500 Neal Becker wrote:
I was interested in trying to configure a local dnsmasq, but when I tried to start it, I found out there was already one running, using port 53.
Libvirtd starts it when the default virtual network is setup to use NAT. I use bridge for everything, so one way to eradicate it is:
virsh net-destroy default virsh net-undefine default
Stop libvirtd, stop dnsmasq, the restart libvirtd and it won't start dnsmasq this time (at least it works that way for me, but I usually reboot rather than trying to stop start individual services).
Once upon a time, Neal Becker ndbecker2@gmail.com said:
Clearly has something to do with libvirt, probably I did some experiment a long time back that required it. But just removing libvirt-daemon is not an option, that would remove a lot of stuff.
Libvirt by default sets up a private local network, NATted towards your Internet connection, with a local dnsmasq for a proxy resolver. If you aren't using that network, you can just disable it and set it to not auto-start:
# virsh net-autostart default --disable # virsh net-destroy default
Otherwise, you can make dnsmasq only listen on certain interfaces, so you could set your instance to not listen on the private network (and IIRC libvirt configures its instance to only listen on that network), and that should work. libvirt configures its instance for separate PID files and such, so that part doesn't conflict with a "regular" instance.
Chris Adams wrote:
Once upon a time, Neal Becker ndbecker2@gmail.com said:
Clearly has something to do with libvirt, probably I did some experiment a long time back that required it. But just removing libvirt-daemon is not an option, that would remove a lot of stuff.
Libvirt by default sets up a private local network, NATted towards your Internet connection, with a local dnsmasq for a proxy resolver. If you aren't using that network, you can just disable it and set it to not auto-start:
# virsh net-autostart default --disable # virsh net-destroy default
Otherwise, you can make dnsmasq only listen on certain interfaces, so you could set your instance to not listen on the private network (and IIRC libvirt configures its instance to only listen on that network), and that should work. libvirt configures its instance for separate PID files and such, so that part doesn't conflict with a "regular" instance.
I see in /var/lib/libvirt/dnsmasq/default.conf: except-interface=lo bind-dynamic interface=virbr0
From dnsmasq man page, I think that means it should only listen on virbr0.
But if I edit /etc/dnsmasq.conf: #interface= # Or you can specify which interface _not_ to listen on except-interface=virbr0
So I think the libvirt dnsmasq should only listen on virbr0, and main dnsmasq should listen on everything except virbr0, but this doesn't work:
Nov 07 14:09:46 nbecker2 systemd[1]: Started DNS caching server.. Nov 07 14:09:46 nbecker2 dnsmasq[11520]: dnsmasq: failed to create listening socket for port 53: Address a Nov 07 14:09:46 nbecker2 dnsmasq[11520]: failed to create listening socket for port 53: Address already in Nov 07 14:09:46 nbecker2 dnsmasq[11520]: FAILED to start up
I didn't want to just unconditionally get rid of the existing dnsmasq, as I don't know how that might bite me in the future and I'll have forgotten all about this.