12.04: How to add local details to dnsmasq config

Marius Gedminas marius at pov.lt
Sun Jun 3 12:31:41 UTC 2012


On Fri, Jun 01, 2012 at 12:18:38PM -0400, Paul Smith wrote:
> On Fri, 2012-06-01 at 10:24 +0300, Marius Gedminas wrote:
> > On Thu, May 31, 2012 at 10:23:59PM -0400, Paul Smith wrote:
> > > However, I don't know how to add extra content to the dnsmasq
> > > configuration network-manager uses.  I can see that network-manager
> > > starts a dnsmasq server that listens on 127.0.0.1 (good stuff) and that
> > > the configuration file is /var/run/nm-dns-dnsmasq.conf which I assume is
> > > being auto-generated by network manager.
> > 
> > Interesting.  I'm on 12.04 as well, and I also use a VPN tool not
> > integrated with NetworkManager (openvpn --config /path/to/config-file
> > --route-nopull --route x.y.0.0 255.255.0.0).  I don't have a
> > /var/run/nm-dns-dnsmasq.conf on my system, even though I most definitely
> > have dnsmasq running. 
> 
> Did you do a clean install or an upgrade?

An upgrade (all the way from Ubuntu 9.10).

> I did a clean install (first
> time since 2009 or so when I bought my current desktop!)  Perhaps if you
> upgrade, the new NM/dnsmasq/resolvconf config is not added.
> 
> Also note if you add KVM (virtualization) that will start its own
> dnsmasq, to provide network services to the virtual machines.  You can
> tell which one is doing what by examining the command line arguments.

Hm.  My sysadmin diary indicates I'd installed resolvconf and dnsmasq
back in 2010 and configured the system-wide dnsmasq to coexist
peacefully with libvirt's one by following the instructions in
/usr/share/doc/libvirt-bin/README.Debian.gz.  And then I uninstalled
both resolvconf and dnsmasq after four days, because DNS caching caused
some issues as I moved my laptop between home and office networks.

I don't have any notes indicating I'd reinstalled dnsmasq and
resolvconf, so I must assume the Ubuntu upgrade pulled them in.
(Actually, it pulled resolvconf in -- the dnsmasq package is not
installed, but the dnsmasq-base is.)

Here are the two dnsmasq instances that are running:

$ ps $(pgrep dnsmasq)|cat
  PID TTY      STAT   TIME COMMAND
 1523 ?        S      0:00 /usr/sbin/dnsmasq -u libvirt-dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file= --except-interface lo --listen-address 192.168.122.1 --dhcp-range 192.168.122.2,192.168.122.254 --dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases --dhcp-lease-max=253 --dhcp-no-override
 3723 ?        S      0:03 /usr/sbin/dnsmasq -x /var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r /var/run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new

I also have an /etc/init.d/dnsmasq (which belongs to the removed dnsmasq
package) and a symlink from it to /etc/rc2.d/S15dnsmasq.

I'm starting to suspect a packaging bug: apt-get remove dnsmasq appears
to be a no-op, as the postrm script only removes the rc.d symlinks on
purge, not on simple removal.  The prerm script does stop the running
dnsmasq, but it's a bit pointless, as it will come back after a reboot.

> > > How can I add/remove config from the local DNS configuration?
> > 
> > dnsmasq supposedly has a DBus control protocol of some kind, but I
> > haven't been able to find documentation for it.
> 
> I don't think this will help.  I want the config file to be modified so
> that the configuration is static and persists beyond daemon restarts.

It seems to me that you could sudo apt-get install dnsmasq and then
add files under /etc/dnsmasq.d/ to have additional static and persistent
configuration.

(Incidentally, I should perhaps mention the 'clear-on-reload' option,
which nicely solves my issues with DNS caches being wrong when I move
between networks.)

Marius Gedminas
-- 
The gates in my computer are AND, OR and NOT; they are not Bill.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20120603/9073be44/attachment.sig>


More information about the ubuntu-users mailing list