Subject: Re: No nameservers configured when using DHCP/dhclient
To: Steven M. Bellovin <>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-users
Date: 05/19/2003 13:58:11
    Date:        Sun, 18 May 2003 19:22:03 -0400
    From:        "Steven M. Bellovin" <>
    Message-ID:  <>

  | >Also the dhclient.leases file contains all the correct information (i.e. 
  | >name server ip's) it just appears as though the script is ignoring them 
  | >or forgetting to configure resolv.conf.
  | >
  | Hmm -- no suggestions on that one.

To debug the dhclient script, edit it (/sbin/dhclient-script) and right
near the start (but after the #! line obviously) add ...

exec >> /tmp/dhclient-debug 2>&1
echo "======================"
echo "$# args: $@"
set -x

and then run dhclient normally, and after it has done, examine the
debug file (/tmp/dhclient-debug - obviously you can put it wherever
you like).

This, along with examination of the dhclient-script (after you have
the output, so you can easily see what is actually being done, and
why) will usually allow any problems to be easily detected.

There is one bug with setting up resolv.conf (I sent a PR about it
see PR bin/21109) that will affect you if you're running dhclient on
more that one interface, but only one of them actually reaches a dhcp
server.  What happens in that case, is that the first interface is configured
just fine, including setting up /etc/resolv.conf - then the 2nd interface
fails to configure (must later, after waiting for timeouts) and
dhclient-script cleans up that interface - which includes cleaning up
/etc/resolv.conf.   If this is the problem, there's a fix in the PR.

(If anyone decides to apply that fix to the NetBSD tree, also look at
21110 while you're there - a more trivial problem that may as well get
fixed at the same time).