tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: dhcpcd behaviour



> I just use dhcpcd(8) to handle IPv6 and use static IPv4 addressing on
> my local network with a hand-written /etc/resolv.conf.

> If I add the upstream network interface to a bridge(4) then the
> /etc/resolv.conf file is overwritten with an empty one, this
> obviously breaks DNS lookup on that machine.

> Any opinions on whether the current behaviour is sensible and the
> best place to fix it if it isn't?

I'm not sure what I think of that.

For some DHCP clients, rewriting /etc/resolv.conf is the Right Thing.
(A roving laptop might be an example.)  For others, it's not.  (Yours
is an example.)

I'm not sure how to tell the difference mechanically.  I'm not even
sure it'd be good to try to tell the difference mechanically;
predictable dumb behaviour is often better than less-predictable
"smart" behaviour.

I could argue either way on which default is better.  (In favour of the
current default, I'd guess the correlation between being competent to
notice/fix the issue and being a site for which rewriting is wrong is
positive; against, I'd say that destroying manually configured
information is a Bad Thing - the .save file helps, but it is way too
easy for it to get overwritten, even assuming the admin is aware it
exists.)

As for how to fix it, I put something like this in
/etc/dhclient-enter-hooks on the few of my machines where I actually
use dhclient (this is from one example, I'm not sure they're all
identical, though they're all similar):

#! /bin/sh
RESOLV=/etc/resolv.conf.dhclient
hostname() {
}
domainname() {
}

The RESOLV= line causes the scripts to write a different file, one
which most (all?) automated procedures ignore; the hostname() and
domainname() functions shut off attempts to scribble on the system's
configured names.  I could have added overrider functions for
make_resolv_conf() and replace_resolv_conf() instead, but this way I
have the resolv.conf that dhclient would have put in place at ready
hand in case I want something from it.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index