On Wed, May 18, 2005 at 11:44:50AM -0600, Shane Hathaway wrote: > 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.
I believe X should point to localhost, not the host name. That way X will continue to run even if there is no network connection. I recall problems with X on HP-UX years ago that I solved by pointing X to localhost. Of course, unless you point X to the IP address, it must do some lookup somewhere. Other applications will have the same problem. The best way to hande that is to have localhost and the hostname in /etc/hosts. > > 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 have folks using servers through your firewall/natting, you should have two definitions of your zone, one for the outside world and one for the (presumably more trustworthy) internal network. That takes care of the outside world's and the LAN's resolution issues, leaving you with the same issue as above. > > 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 | > `===================================' -- Charles Curley /"\ ASCII Ribbon Campaign Looking for fine software \ / Respect for open standards and/or writing? X No HTML/RTF in email http://www.charlescurley.com / \ No M$ Word docs in email Key fingerprint = CE5C 6645 A45A 64E4 94C0 809C FFF6 4C48 4ECD DFDB
pgpaHxryOeSm1.pgp
Description: PGP signature
.===================================. | This has been a P.L.U.G. mailing. | | Don't Fear the Penguin. | | IRC: #utah at irc.freenode.net | `==================================='
