Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an Ubuntu server called crow:

$ hostname

But when I try to ping it (from itself), I get unknown host:

$ ping crow
ping: unknown host crow

This is despite explicitly adding crow to /etc/hosts:

$ sudo cat /etc/hosts       localhost crow

What am I doing wrong?

Additional info in response to comments:

The hosts line of /etc/nsswitch.conf looks like this:

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
share|improve this question
Have you rebooted/restarted networking services after making the edit to your hosts file? – BloodPhilia Feb 2 '11 at 16:50
Modification of hosts file doesn't require restart of network services. – Sameer Feb 2 '11 at 17:20
What does the hosts line in /etc/nsswitch.conf look like? – David Mackintosh Feb 2 '11 at 17:44
where do you ping it, from the server itself or from another machine in the same lan? – Nicola Boccardi Feb 2 '11 at 19:04
I've edited to answer these questions – sanity Feb 2 '11 at 19:29
up vote 4 down vote accepted

Check permissions on /etc/hosts and /etc/nsswitch.conf files. They should be world-readable.

share|improve this answer
Indeed, there should be no need for sudo in sudo cat /etc/hosts. – hlovdal Feb 2 '11 at 21:04
That fixed it, thanks! – sanity Feb 2 '11 at 21:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.