which is better/more correct for /etc/hosts

Bill Campbell linux-sxs at celestial.com
Wed Dec 12 13:05:21 PST 2007


On Wed, Dec 12, 2007, Michael Hipp wrote:
>Douglas J Hunley wrote:
>>is this better:
>>192.168.10.1	servera,serverb,serverc
>>or this:
>>192.168.10.1	servera
>>192.168.10.1	serverb
>>192.168.10.1	serverc
>>
>>and why is it better?
>
>'man hosts' seems to direct that the first form be used (except with 
>whitespace, not commas).

I wouldn't expect the 2nd format to work as I don't think that
multiple lines with the same IP address is defined.

The approved form is:

ipaddress fqdn alias [alias]

The proper solution though is to have this information in a
proper DNS server, perhaps using split-horizon for private
networks and subdomains.

I have built /etc/hosts files for machines where they may be
problems booting the systems after power failures when DNS
resolution isn't available.  This can come back to bite though if
an IP address changes in the DNS and the /etc/hosts file isn't
changed to match.  It can cause much head-scratching as to why
the change one put in DNS isn't showing up correctly.

Bill
--
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

It is practically impossible to teach good programming style to
students that have had prior exposure to BASIC: as potential
programmers they are mentally mutilated beyond hope of
regeneration.  -- Dijkstra



More information about the Linux-users mailing list