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

Re: /etc/hosts and resolving of the local host/domainname - 127.0.0.1 vs. 127.0.1.1



On Tue, 2013-07-30 at 23:09 +0100, Ulrich Dangel wrote:
> If you are in a situation with no stable DNS you can use
> libnss-myhostname which resolves the hostname to your local configured
> IP addresses or 127.0.1.1 & ::1 if no IP address is configured.
Yeah... but this doesn't change the "problem" that 127.0.1.1. is used...


Some technical reasons against my own proposal:

1)
I had some off list communication with Thomas Hood in the meantime and
one (strong?) reason back then apparently was, that cyclic resolution
wouldn't work anymore if both, localhost and the hostname point to
127.0.0.1, e.g.

/etc/hosts:
127.0.0.1 localhost
127.0.0.1 hostname[.domain    hostname]

If you now resolve "hostname" you get 127.0.0.1, if you reverse-resolve
that, you get localhost (and not hostname).


Surely this is the case, an Thomas meant it caused many troubles... I
tried it, and so far I couldn't find a program which couldn't deal with
that (but obviously I only made a few tests).

And there is not really any guarantee by the concepts of DNS, that this
"cyclic" resolving will work.
So if a daemon makes this assumption it is anyway kinda broken IMHO.


The only major example I know where this is used  in a sense are
mailservers.


2) hosts(5) (also pointed out by Thomas):
"This file is a simple text file that associates IP addresses with
hostnames, one line per IP address."

So that would mean that double entries like I proposed were forbidden
anyway.
I used this however since many years and never found a case where it
didn't work.
Even things like bash's completion seem to happily work with multiple
associations for one address.
Not sure if that text line in the manpage is just a relict from the
past.



Cheers,
Chris.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Reply to: