Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the '10.3: A possible workaround for accessing localhost' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: A possible workaround for accessing localhost
Authored by: BillCole on Nov 21, '03 05:33:55PM
It is up to the DNS server to have an entry (and reverse entry) for localhost. If that is missing, localhost just plain won't work as you expect.

Hopefully not. Every machine that needs TCP/IP name resolution of any sort SHOULD have its own local entry or entries for localhost in whatever local name resolution mechanism it uses. For example, MacOS X has a file at /etc/hosts that is used in single-user mode (and in fact during boot before networking or NetInfo is up) and the default NetInfo entries include localhost entries. Not having such entires locally is a very serious security hole because it would let a DNS server tell you who you are. I have seen people cause serious trouble by removing their local mapping of localhost or making it subsidiary to what DNS says.

What is happening with these failures is that at some point whatever process is asking for name resolution is getting back the IPv6 address for the loopback (::1) as the address of 'localhost' and trying to use it for a connection that cannot be made because there is no IPv6 listener for whatever it is trying to connect to. The program SHOULD then look for the other address for localhost (the IPv4 address and connect to that instead, but some (many? most?) programs don't anticipate that particular failure mode and simply fail because the first connection failed.

If you want to see proper recovery in action, try 'telnet localhost 22' and note the success (if you have SSH on) then try 'telnet localhost 80' and note the initial failure and then success (if you have the web server running.)

[ Reply to This | # ]