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

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

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

What is nice about it is this:

    $ hostname
    $ hostname --fqdn

One can of course have:	localhost	pingo

but then:

    $ hostname --fqdn

I haven't run into any problems doing it the first way.  What worries
me is that hosts(5) says: 

       This file is a simple text file that associates IP addresses
       with hostnames, one line per IP address.

Should this be understood as a prohibition on multiple lines per
IP address?
Thomas Hood

Reply to: