Re: /etc/resolv.conf, /etc/ppp/resolv.conf, dhcp3-server and dnsmasq
On Sat, Dec 29, 2007 at 11:06:41AM -0700, firstname.lastname@example.org wrote:
> At Thu, 27 Dec 2007 20:28:21 -0500 email@example.com wrote,
> "Install the resolvconf package. It keeps track of what should be in
> resolv.conf based on what networks are active."
> Thanks. resolvconf has been present since long ago. After
> your message I purged it, reinstalled and tried ppp again.
> (Oddly, purging resolvconf did not remove /etc/resolv.conf.)
> No dice. /etc/ppp/resolv.conf has two nameserver addresses
> but they are not copied to /etc/resolv.conf after ppp connects.
> Of course, if I
> cp /etc/ppp/resolv.conf /etc/resolv.conf
> names are then resolved; but as you say resolvconf should
> do this or something similar. Also, the addresses are not
> removed from /etc/resolv.conf when ppp disconnects.
> Also, this is in syslog at startup.
> Warning: /etc/resolv.conf is not a symbolic link to /etc/resolvconf/run/resolv.conf
> Since when is /etc/resolv.conf a link rather than a file?
The resolvconf package makes it a link. If it is not a link, the
resolvconf package can't work. When ppp is active, are your nameservers
present in /etc/resolvconf/run/resolv.conf?
My setup is a little more complicated to follow, although the actual
setup is right out of the box. I have pppconf to set up my ppp peer and
pppd gets the nameservers when it connects. That info goes into
I have the resolvconf package installed. Perhaps I don't need it for
the current system where I have two boxes, one acting as a gateway with
a modem, the other gets its internet (and name service) from the first.
However, I can switch that around in about 30 seconds if the primary box
fails (or its serial port to the modem fails).
I also have the dnsmasq package installed which acts like a caching dns
server. Therefore, my /etc/resolv.conf file points to
/etc/resolvconf/run/resolv.conf which contains a pointer to 127.0.0.1,
the localhost where it finds a dns service running (dnsmasq).
Resolvconf runs a hook script provided by dnsmasq that updates dnsmasq's
ideas on upstream nameservers. It is dnsmasq that then contacts these
nameservers if a dnsrequest can't be fulfilled out of its own cache.
The magic for all this is done by resolvconf. See the man page for all
the gory details and try to follow all the hook scripts.
> So perhaps this is the problem: if /etc/resolv.conf is the link,
> it gets updated automatically for a new connection. If it
> is a file, it is left unchanged.
Yes, see the resolvconf man page.
> Luckily a cable modem is also available. If connected to the 'net
> through eth0, /etc/resolv.conf gets the nameservers for the
> cable ISP. So the problem is with ppp but not with eth.
> Name resolution worked until about the time I tried udhcp,
> dhcp3-server and dnsmasq. I wonder whether one of these
> installations changed something in /etc/ppp/ or resolvconf.
> In principle, name resolution is a simple concept. Pity that
> the implementation is so tangled. Any ideas to solve this
It is only simple if you only have one interface that comes up on boot
and doesn't change. With eth? and ppp? interfaces coming up and going
down, the resolvconf package does a good job of keeping things working.
With dnsmasq being its own dns server, it makes finding out the IP
numbers of the upstream nameservers different in that you find it in
If you have resolvconf installed, it will keep things straight. When
you connect through an eth0, presumably either you are given the DNS
name servers to put in /etc/network/interfaces or the system gets them
with dhcp. Note that if you should try to connect to the internet with
ppp at the same time, default routing and dns servers will not change
and life gets interesting.