Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an Ubuntu server called crow:

$ hostname
crow

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
127.0.0.1       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
3  
Modification of hosts file doesn't require restart of network services. –  Sameer Feb 2 '11 at 17:20
2  
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

1 Answer 1

up vote 3 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

 
discard

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.