Can't make NM work with local caching DNS resolver

I am trying to set up dnsmasq as a local resolver cache on my F-12
laptop, and can't find any way to pass the nameservers returned by DHCP
to dnsmasq as upstream nameservers and still have appear as
the primary nameserver in /etc/resolv.conf.

NetworkManager creates a resolv.conf file that contains only the servers
returned by DHCP.  That does not allow queries from local processes to
be routed through the local caching resolver.

Without NetworkManager, I would just put a line in dhclient.conf to
prepend "" to the list of nameservers returned by DHCP.
dnsmasq would then read resolv.conf, nicely ignore that entry, and use
the other nameserver entries as upstream servers.  NetworkManager always
invokes dhclient with a custom config file that is created anew for each
invocation, and gives no means to add this customization.

If I configure NetworkManager to put "" as a nameserver in
resolv.conf, then _only_ that nameserver will appear, and dnsmasq has
no way to discover the upstream servers.  Plus, this is extremely
inconvenient since it has to be done manually for each unique WiFi

I cannot simply hard code the upstream servers in /etc/dnsmasq.conf
because that would ignore what DHCP returns.

I can put a script in /etc/NetworkManager/dispatcher.d/ to modify
resolv.conf and dnsmasq.conf to my liking, and all the needed
parameters are available, but that script does not get invoked for
lease renewals, at which time dhclient would undo my resolv.conf

Getting rid of NetworkManager really isn't a viable option for a laptop
that needs to connect to various WiFi networks.

The only reference to this issue that I've been able to find is a
mailing list thread from 2008 that seems to have degraded into a
flamewar with no resolution:

Has anything further happened regarding this?  Any suggestions?

Bob Nichols         RNichols42 comcast net

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