Date: Thu, 4 Jan 1996 16:47:47 -0800 (PST) From: Donald Burr <d_burr@ix.netcom.com> To: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: a couple host.conf and nameserver questions... Message-ID: <Pine.BSF.3.91.960104163413.2575A-100000@ncc-1701-d.starfleet.gov>
next in thread | raw e-mail | index | archive | help
I run FreeBSD 2.1-release on my 486/66, which is connected to the rest of
the world via a 28.8 PPP connection. Naturally, this ain't no 56k line,
and so things tend to bog down sometimes, especially when I'm FTP'ing in
another session or something. This especially hurts stuff like
IP->hostname resolution, e.g. when using the "netstat" command or
similar. So I decided to try something: I figured, as an experiment, to
put the IP addresses and hostnames of some commonly-used hosts
(ftp.cdrom.com, ftp.freebsd.org, all the various netcom servers, etc.)
into /etc/hosts. Because I remember vaguely that there is a way to tell
UNIX to search /etc/hosts BEFORE going out on the net and consulting a
nameserver.
Back in my heydey of Ultrix, I remember there was a file called
something like /etc/svc.conf where I could say something like "hosts =
hosts, bind", which basically meant that the system would look in
/etc/hosts to resolve IP addresses to names, before checking the
nameserver. (Please excuse any mistakes, it's been a long time, and one
I'd rather forget...)
More recently, when running LInux, I could use the /etc/host.conf and put
"order = hosts, bind" in it to do the same thing.
But apparently, FreeBSD doesn't work that way.
If I just put "hosts" alone in /etc/host.conf, then it works fine. But
if I try accessing a host that's not in /etc/hosts, it craps out wiht an
error. OK, this makes sense. But it isn't quite the desired behaviour.
If I put:
bind
hosts
in it, then it checks the nameserver first, and if the nameserver doesn't
know about it, THEN it looks in /etc/hosts. This works too -- the
nameserver knows about Internet hosts I'm contacting, but DOESN'T know
about hosts on my local ("fake") ethernet. But /etc/hosts knows about
these, so everything is still cool.
BUT (and here's the clincher), if I put:
hosts
bind
in /etc/host.conf... well, you'd figure that it'll check the hosts file
first, and if it can't find it, it'll check the nameserver. WRONG!! It
still insists on checking the nameserver first, then /etc/hosts. Not the
desired behavior either.
So what's going on here? Is this a bug in the shared libraries, or the
networking code, or whatnot? (FYI, this system usd to be a 2.0.5 box, so
MAYBE some old 2.0.5 stuff is still hanging around... if this behavior
is fixed in 2.1, then that it might be the time to throw caution to the
wind and go ahead and do a full re-install)
Now, on an aside: Is it possible for me to set up a SMALL nameserver
(named) on my machine that will somehow CACHE all recent IP->host mappings
that my box does, so taht if I've associated an IP with a host name
already, it won't have to go out on the ppp link to access the internet?
enquiring minds want to know...
Donald Burr [d_burr@ix.netcom.com], PO Box 91212, Santa Barbara CA 93190-1212
TEL (805)564-1871 / FAX 564-2315 / WWW http://www.geopages.com/WallStreet/2072
PGP Public Key available by request (send e-mail) or on Public Key Servers.
** Uphold your right to privacy - Use PGP. **
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.960104163413.2575A-100000>
