[Dnsmasq-discuss] Why is dnsmasq reading /var/run/dnsmasq/resolv.conf twice when it starts up?

Chris Green cl at isbd.net
Thu Oct 3 17:05:48 BST 2013


On Thu, Oct 03, 2013 at 04:42:59PM +0100, Simon Kelley wrote:
> On 03/10/13 16:29, Chris Green wrote:
> >When I start dnsmasq I see the following in syslog:-
> >
> >Oct  3 16:09:03 revo dnsmasq[2819]: started, version 2.63rc6 cachesize 150
> >Oct 3 16:09:03 revo dnsmasq[2819]: compile time options: IPv6 GNU-getopt 
> DBus i18n IDN DHCP DHCPv6> 
> >Oct 3 16:09:03 revo dnsmasq-dhcp[2819]: DHCP, IP range 192.168.1.80 -- 
> 192.168.1.150, lease time 1h 
> >Oct  3 16:09:03 revo dnsmasq[2819]: using local addresses only for domain zbmc.eu
> >Oct  3 16:09:03 revo dnsmasq[2819]: reading /var/run/dnsmasq/resolv.conf
> >Oct  3 16:09:03 revo dnsmasq[2819]: ignoring nameserver 192.168.1.2 - local interface
> >Oct  3 16:09:03 revo dnsmasq[2819]: using nameserver 194.72.0.114#53
> >Oct  3 16:09:03 revo dnsmasq[2819]: using nameserver 212.159.6.10#53
> >Oct  3 16:09:03 revo dnsmasq[2819]: ignoring nameserver 127.0.0.1 - local interface
> >Oct  3 16:09:03 revo dnsmasq[2819]: using local addresses only for domain zbmc.eu
> >Oct  3 16:09:03 revo dnsmasq[2819]: read /etc/hosts - 12 addresses
> >Oct 3 16:09:03 revo dnsmasq-dhcp[2819]: not giving name revo.zbmc.eu to 
> the DHCP lease of 192.168.> 
> >Oct 3 16:09:03 revo dnsmasq-dhcp[2819]: not giving name revo to the DHCP 
> lease of 192.168.1.148 be> 
> >Oct  3 16:09:05 revo dnsmasq[2819]: reading /var/run/dnsmasq/resolv.conf
> >Oct  3 16:09:05 revo dnsmasq[2819]: ignoring nameserver 192.168.1.2 - local interface
> >Oct  3 16:09:05 revo dnsmasq[2819]: using nameserver 194.72.0.114#53
> >Oct  3 16:09:05 revo dnsmasq[2819]: using nameserver 212.159.6.10#53
> >Oct  3 16:09:05 revo dnsmasq[2819]: ignoring nameserver 127.0.0.1 - local interface
> >Oct  3 16:09:05 revo dnsmasq[2819]: using local addresses only for domain zbmc.eu
> >
> >Why is it doing everything twice?
> >
> Probably because whatever populates /var/run/dnsmasq/resolv.conf
> alters the modification time just after it starts dnsmasq.
> 
That makes sense I guess!

> >
> >While I'm about it, what creates/populates /var/run/dnsmasq/resolv.conf?
> 
> We need more context to have a hope of answering that.
> 
OK.  As you may gather I'm playing about a bit with my dnsmasq
configuration on the server machine at 192.168.1.2.  It's a small Acer
Revo machine running Ubuntu 12.10.

I recently changed ISP and thus needed to change the DNS servers that
dnsmasq uses upstream of itself.  That was my first problem because I
couldn't find where these are set.  I *think* I have found it now,
they're in the files in /etc/NetworkManager/system-connections.  I have
in "Wired connection 1":-

    [802-3-ethernet]
    duplex=full
    mac-address=00:01:6C:6C:C7:9B

    [connection]
    id=Wired connection 1
    uuid=2262541a-2106-4e4d-b2b7-ab631dddcbf1
    type=802-3-ethernet
    timestamp=1361810287

    [ipv6]
    method=ignore

    [ipv4]
    method=manual
    dns=127.0.0.1;212.159.6.9;212.159.13.49;
    dns-search=zbmc.eu;
    addresses1=192.168.1.2;24;192.168.1.1;
    may-fail=false

Presumably (relating to the other thread) I can add a 'manual' ipv4
section like the one above to the file in the same directory that
relates to the wireless interface.

The "doing things twice" was just something I noticed, probably
NetworkManager is doing things at boot time and happens, as you said, to
change the file just after dnsmasq reads it.  Not a big issue really, it
only happens at boot time I think.


Hopefully all these things are resolved now and I can leave the list in
peace.  However I did have one issue where, after rebooting the dnsmasq
server machine nothing worked at all (i.e. no DNS or DHCP) until I
manually restarted dnsmasq itself.  I'll try it all again, carefully,
and see if the same happens again.

-- 
Chris Green



More information about the Dnsmasq-discuss mailing list