Subject: Re: dhclient configuration
To: Marc Sernatinger <msernatinger@hotmail.com>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-help
Date: 09/05/2001 01:36:37
    Date:        Tue, 04 Sep 2001 12:00:48 -0500
    From:        "Marc Sernatinger" <msernatinger@hotmail.com>
    Message-ID:  <F104CZZ5a0TihNW9T8x00007140@hotmail.com>

  | So I was wondering if anyone had some advice 
  | on how to edit this file to get functional internet. Thanks.

You shouldn't need to - an empty dhclient.conf file is often just fine.

You first need to work out what it is that isn't working with the
empty file - since you can ping local stuff, the basic address assignment
and interface configuration is clearly OK, so I'd ignore the other replies
that you were sent, I don't think that what they suggested will help
with your problem (though they might in other cases).

What's in the output of "netstat -rn -f inet" (after dhclient has run
and configured the interface)?

If there's a line that starts "default ..." then you have a default
route configured, and assuming you didn't manually configure it
yourself, or put it in /etc/defaultrouter, then it must have come from
dhcp.  That's a good sign, if it happened.

Next take the IP address from that line, and ping it
	ping -n a.b.c.d

You should get answers.   That indicates that the route is aimed at
something that exists at least, and if it came from dhcp, it is likely
to be correct.

If there's no default line in the netstat output, then likely you have
to explicitly tell the dhcp server that you need that info provided
(see later in this message).

If the line is there, but there's no answer to the ping, then you need
to contact whoever runs the local LAN and/or dhcp server and find out
what is going on.   If you can ping the router, then find out the IP
address of some other node somehow (one outside your net) [I won't suggest
one to avoid this message being archived and the whole rest of the world
using that one forever] and "ping -n w.x.y.z" and see if you have
successful routing, if not, the problem isn't dhcp, it is elsewhere.

Next, look at /etc/resolv.conf - if that contains one or more lines
that start "nameserver" (and again assuming you didn't manually configure
it yourself) then the dhcp server is setting up your nameserver info.
If there is such a line (or several) take the IP address from the first
line in the file and do "dig @a.b.c.d ns ." (send a query to that nameserver
and ask it for the names of the root nameservers).   If you get an answer
with lots of A.ROOT-SERVERS.NET type names in it, then the DNS config is
fine.   If you get no answer, then your local resolver back end is down,
or the dhcp server is giving out a bad address (you can try other nameserver
lines in resolv.conf if there are any, but the first one is the one that
really matters).   Again, contact local maintainers if that is happening.

If there are no nameserver lines in /etc/resolv.conf (or the file doesn't
exist at all), then dhcp isn't telling you the nameserver addresses, you
might need to explicitly ask for them.

If you find that you aren't getting info from the dhcp server, then you
need to add just one line to /etc/dhclient.conf - something like

request ntp-servers, domain-name, domain-name-servers, routers,
        host-name, lpr-servers, nntp-server, pop-server, smtp-server,
        static-routes, subnet-mask;

where you get to pick what things you actually request - but beware,
usually requesting anything will mean that you only get the info that
you ask for.

Of the list above, NetBSD will use only domain-name domain-name-servers
routers host-name and subnet-mask by default - so asking for any of the
others is a waste of time with a standard config (or any config for most
of the rest - that's from my dhclient.conf - I ask for all that just so
I can see what the local dhcp server is willing to tell me...)

"domain-name-servers" and "routers" are the two you might need.  But you're
also going to need to ask for at least "subnet-mask" to make sure you get
that one, and probably "domain-name" and maybe "host-name" as well, that is
if you need to ask for anything (if you don't, the server sends you what it
considers to be enough useful information for you - that would usually
include routers, but might not include domain-name-servers).

If all this is correct, you have nameservers that work, and a default
route that answers, but you still can't reach the outside world, then
again, you need to contact local people - they my be filtering or something
and not allowing your address out (perhaps they only allow HTTP access,
and only through a local proxy or something - I have heard of dumber setups).
You might need to get filter/firewall rules changed, or something.

kre