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?: > > 127.0.0.1 localhost > 127.0.0.1 pingo Not really. The behaviour you see is somewhere between a bug and a feature. The above two lines *must* be precisely equivalent to *one* of the following four lines: 127.0.0.1 localhost 127.0.0.1 pingo 127.0.0.1 localhost pingo 127.0.0.1 pingo localhost Off the top of my head I couldn't tell you which one it is. But under the NSS interface, it must be one of them, because that is what gethostby*() is going to return to applications. Note that #247734 contains confusing misinformation. It uses host(1), which ignores /etc/hosts and uses DNS directly - and DNS can represent things which NSS cannot. Try with 'getent hosts' for the real story. > What is nice about it is this: > > $ hostname > pingo > $ hostname --fqdn > pingo That's '127.0.0.1 pingo localhost' The problem then is that 'getent hosts 127.0.0.1' returns 'pingo' instead of 'localhost'. -- .''`. ** Debian GNU/Linux ** | Andrew Suffield : :' : http://www.debian.org/ | `. `' | `- -><- |
Attachment:
signature.asc
Description: Digital signature