/etc/hosts - how does that file work?? - was weird nfs issues.

Mel Flynn mel.flynn+fbsd.questions at mailing.thruhere.net
Mon Jun 8 23:52:47 UTC 2009

On Saturday 06 June 2009 20:44:38 Tim Judd wrote:
> On 6/4/09, Peter <fbsdq at peterk.org> wrote:
> > I do not think /etc/hosts does round robin, I always assumed first match
> > wins...DNS/bind I would understand...

It's the same library call: gethostbyname(3) and friends.

> > Why does ping always return the address,
> >  and ftp,nc,ssh,telnet,fetch _always_ uses the 116 address?

Again: client implementation is allowed to pick whichever it wants.

> why are you so hung up on dual IPs for a single host?  would dnsmasq
> provide a solution to dual A records for one resource?

Gotta agree with Tim here. I don't see the point for having two nets on one 
interface. They'll be hard to keep secure with firewall rules if you run the 
same services on them.

> I'll help, when I can.  but forcing this on /etc/hosts is a dead end.

Problem is that nfs and DNS don't work well at all. For nfs best use IP or 
/etc/hosts. One drawback of using DNS with nfs is that if the hostname cannot 
be resolved (network down, typo), one can also not get a console when it goes 
to single user mode [1] and has to reboot via power button.

/etc/fstab is supposed to be static to begin with. It's supposed to provide 
the mountpoints the system can count on, so using IP's for nfs is preferred. 
For the more dynamic nfs mounts, one can use hostnames and use noauto in the 
options column.

[1] http://www.freebsd.org/cgi/query-pr.cgi?pr=128448

More information about the freebsd-questions mailing list