How can I make local dnsmasq play nicely with NetworkManager?
Robert Nichols
rnicholsNOSPAM at comcast.net
Fri Jul 30 11:23:39 UTC 2010
On 07/29/2010 10:05 AM, Robert Nichols wrote:
> On 06/28/2010 02:33 PM, Robert Nichols wrote:
>> 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 127.0.0.1 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 "127.0.0.1" 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 "127.0.0.1" as a nameserver in
>> resolv.conf, then _only_ that nameserver will appear, and dnsmasq has
>> no way to discover the upstream servers.
>
> FWIW, I've written a C program that makes this work. The program sets
> up a file alteration monitor on /etc/resolv.conf. Whenever that file
> changes, the code ensures that "127.0.0.1" is the first nameserver
> listed there and passes the upstream server addresses to dnsmasq. A
> short script in /etc/NetworkManager/dispatcher.d makes sure this program
> is running whenever a network interface is started. I believe it's
> pretty bulletproof, and most of its configuration can be overridden from
> the command line.
>
> Source is available from
>
> http://rnicholsNOSPAM.home.comcast.net/resolvtrac.tar.gz
Word from the developers is that one of the goals for NetworkManager 0.8.2
is support for a local caching resolver. That should eliminate the need
for my workaround.
--
Bob Nichols "NOSPAM" is really part of my email address.
Do NOT delete it.
More information about the users
mailing list