Re: [PATCH] dnsmasq DBUS integration



Mathieu Trudel-Lapierre wrote:
On Thu, Apr 19, 2012 at 2:16 PM, Howard Chu<hyc symas com>  wrote:
[...]
But if NM is *not* the only thing making sure DNS is set up correctly, and a
savvy sysadmin has already painstakingly configured the network on his
machine, there should be a (non-default of course) config option to tell NM
to keep its grubby paws off.

On my server boxes with static network configurations I would just leave NM
uninstalled but that breaks too many other dependencies on modern distros.
On my laptop using dnsmasq is the only sane way to work; I've got blacklists
configured for spam domains and such that I want active no matter what
network I've connected to.

If you're indeed running on Ubuntu, default server installations don't
ship with NetworkManager at all. On the desktop, I believe there are
enough facilities to configure static interfaces (basically, via
/etc/network/interfaces), which will avoid NetworkManager touching
configuration. This includes /etc/resolv.conf as far as I know.

So if you're "savvy" enough to want to use "static" network
configurations via /e/n/i (even using DHCP), I believe things are all
working properly if all interfaces are defined there. NM just
considers them up, which will have your other applications work.

If you're using some interfaces configured in /e/n/i and some (like
wifi) in NM, then yes, NM is expected to update /etc/resolv.conf, just
like dhclient does, to set the correct DNS nameservers as received
from DHCP. On static configurations in NM, it will apply the
configuration set for that connection. If you're using dnsmasq
already, I guess you could make all these connections just write
127.0.0.1 to /etc/resolv.conf (e.g. set it as DNS nameserver in NM)
and you'll be able to continue using dnsmasq to resolve.

Note that in Ubuntu 12.04 we're starting to ship dnsmasq enabled as
started as a local resolver (though we disabled caching).

So, perhaps so that everyone can understand your particular use case,
could you please tell us more about your particular config?

There are several different issues colliding here. The issues on my laptop are not quite the same as on my desktop or servers.

One of the reasons I first was bothered enough to check into this (4-5 years ago now) was that I'd bought a cheap SSD for my laptop and it was crappy enough that I wanted to minimize extraneous writes to the disk. After managing to make most of my root partition read-only I was still stuck with NM rewriting resolv.conf every time I moved the laptop to a different wifi network.

Just telling every connection to write 127.0.0.1 into /etc/resolv.conf doesn't solve that need. I don't want anyone writing anything into the file at all. I want to write it once, and never have it touched ever again. I want to be able to leave /etc as a read-only partition the majority of time, until I need to make any new config changes.

Another (lesser) motivation here is to extend battery life - anything to minimize disk I/O is always a win.

I also have been working on bidirectional USB tethering with my Android phones; sometimes I want my laptop to share my phone's 3G network connection, sometimes I want my phone to share my laptop's wired network connection. The stock tools on phone and laptop handle the former case easily; it still takes manual intervention to do the latter.

Currently my /etc/dnsmasq.conf just loads /etc/dnsmasq.more.conf, and that contains:

####
# local customizations
domain-needed
bogus-priv
enable-dbus
no-poll
address=/doubleclick.net/intellitxt.com/0.0.0.0
address=/tribalfusion.com/yieldmanager.com/0.0.0.0
address=/yieldmanager.edgesuite.net/adsdk.com/0.0.0.0
address=/kontera.com/googlesyndication.com/0.0.0.0
address=/netfirms.com/zedo.com/0.0.0.0
interface=lo
bind-interfaces
bogus-nxdomain=64.94.110.11
####

--
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]