Can't resolve localhost on Mac OS X Server
- by iainbeeston
I have a server running OS X Server 10.5 and it can't resolve localhost to 127.0.0.1.
When I try ping this is what happens:
 ping localhost
ping: cannot resolve localhost: Unknown host
SSH and web browsers get similar results (uknown host). If I try using 127.0.0.1 or the ip address assigned on the LAN all of the above work.
Here's the contents of my /etc/hosts file:
 cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost
I have no local DNS service running.
Does anyone have any idea why this might be happening or how I can fix it?