Hans Fugal wrote:
> Here's one of those deep questions. What is the proper format for the
> loopback line in /etc/hosts? I've seen all of the following:
> 
> ...
> 
> 127.0.0.1 localhost.localdomain localhost foo foo.example.com
> 
> ...
> 
> 127.0.0.1 localhost localhost.localdomain
> 10.0.0.1 foo.example.com foo

I think your question is whether /etc/hosts should map the box's host
name to 127.0.0.1, or to a public address.  The other variations you
listed are just different ways to spell the same thing.

On desktop machines, I always map the box's host name to 127.0.0.1.  If
I don't, I've noticed the X server frequently pauses for several seconds
while it does some kind of name lookup.  When I map the host name to
127.0.0.1, there is no pause.  Even worse, if the box's host name maps
to a dynamically assigned address, and the address changes, the X server
sometimes refuses to open new windows.  Again, with 127.0.0.1, it never
changes.

On servers, the choice is harder.  Some server applications tell clients
to connect back to the server by IP address, and if the server
determines from /etc/hosts that its address is 127.0.0.1, the client is
going to get confused.  So it's best to assign the server's host name to
its public address.  If your server is behind NAT (network address
translation), however, you have another choice to make: do you assign it
the internal address (generally 192.168.x.x or 10.x.x.x) or the external
address?  It depends on who uses the server.

If you're lucky, you have no server applications that care what the
box's IP address is and you can just map your host name to 127.0.0.1.

Shane
.===================================.
| This has been a P.L.U.G. mailing. |
|      Don't Fear the Penguin.      |
|  IRC: #utah at irc.freenode.net   |
`==================================='

Reply via email to