[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /etc/hosts: Two lines with the same IP address?

On Tue, Jun 08, 2004 at 02:40:55PM +0200, Thomas Hood wrote:
> The question has arisen in #247734:

> Is it legal for /etc/hosts to contain two lines with the same
> IP address?  In particular, is the following legal?:

>	localhost
>	pingo

No, these would be duplicate keys and one of the two will never be used
(or they'll be used inconsistently).

> What is nice about it is this:
>     $ hostname
>     pingo
>     $ hostname --fqdn
>     pingo

> One can of course have:
>	localhost	pingo
> but then:
>     $ hostname --fqdn
>     localhost

See other responses for the fix for this; but, er, why would you want
the canonical name for to be anything other than "localhost"
anyway?  That just invites confusion, IMHO.

Steve Langasek
postmodern programmer

Attachment: signature.asc
Description: Digital signature

Reply to: