telnet on local LAN question (progress?)

Tim ignored_mailbox at yahoo.com.au
Fri Aug 26 10:19:12 UTC 2011


On Thu, 2011-08-25 at 23:33 -0700, Paul Allen Newell wrote:
> I went back through archives of my installs and found a sufficiently
> different factory-install of /etc/hosts that I wanted to post it for
> comment given your "bad idea to bodge (sic?) anything else into those
> two lines. I checked 3 machines and they are the same, so I submit
> only one:
> +++
> cat /etc/hosts
> 127.0.0.1    chalupa.localdomain    chalupa  localhost.localdomain    localhost    localhost4
> ::1    chalupa.localdomain    chalupa    localhost6.localdomain6    localhost6
> +++

Yes, it's a common thing to see (Fedora's install routine shoving them
in there).  And *can* be a common problem.  Not always, but when you
start having weird name resolution issues with some servers, it's the
first thing to sanitize.

The format of the hosts file is the IP address, the (full) named address
for that IP, and a list of optional aliases.  Any lookup for the name to
go with an IP will return the first name in the list.  Any lookup for
the IP will match any name in the list.

So, using your list, anything that wants to find the name to go with
127.0.0.1 will be told chalupa.localdomain.  Traditionally, it ought to
be localhost.

Conversely, it would be traditional that any lookup to find the IP
address for the machine name (chalupa.localdomain) would find the IP it
uses on the network (192.168.2.10), but yours would return 127.0.0.1,
because it's the first answer that matches.  You could counter that by
putting the 192.168... lines above the local lines.

I seem to recall one reason why machine names were bodged into the local
loopback lines harking back to people insisting their machine name was
applied (in some other configuration file), rather than letting the
machine work it out for itself, and trying to start up their machine
when not connected to the network, and some service complaining that it
couldn't connect so it wouldn't start.  I seem to recall X refusing to
start, at one point (it's been a very long time since I've seen that,
though, maybe before Red Hat Linux became Fedora).  I've certainly seen
the GDM login screen change from using my hostname.domain name to
localhost.localdomain, at times that the ethernet interface wasn't up at
the time (though it's been a long time since I saw that behaviour, many
releases ago).

It's probably not going to cause most people any problems.  But you were
having some strange names in your mail headers.  Whether that *really*
makes any problems other than an issue for you trying to work out where
your mail has been through, I don't know.  Since your mail tests were
going up the spout, I'd have tweaked things to work in the traditional
way, to minimise any chance of this being a part of the problem, and to
make debugging mail headers much easier.


> This was snapped after I had installed F14 and before I edited hosts
> to know about the other machines. No comment about "Do not
> remove" (that vanished a couple of releases ago if my memory is
> correct) and it makes sense that /etc/hosts would have both the
> machine name as defined during the install and the "generic"
> localhost.

There's some logic to it, the idea being that your machine stays named
the same, even if it can't connect to a network.

The "do not modify the file" warning was always badly worded.  It told
you not to modify a file that had already been modified, few people
would have seen the contents before that happened.

But, it has been known to cause some people problems.  And putting non-
local loopback addresses into the local loopback lines has been debated
many times in the past.  And not just with Linux boxes.

-- 
[tim at localhost ~]$ uname -r
2.6.27.25-78.2.56.fc9.i686

Don't send private replies to my address, the mailbox is ignored.  I
read messages from the public lists.





More information about the users mailing list