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 was installing a Tomcat webapp that refused to work until I stumbled on someone else's issue with an unrelated product. The solution was to add the machine's name to /etc/hosts, to match the name returned by hostname. Is this required for general Linux networking to function correctly?

My webapp is running in a virtual machine so that I can test the webapp, and I don't normally bother with the /etc/hosts file on VMs. I just shook my fist and cursed Tomcat and webapp's behavior. I read, but that doesn't say if it's required or not.

share|improve this question
up vote 0 down vote accepted

If DNS won’t resolve a system’s hostname to an IP, things may break, depending on how they’re configured — unless you manually add an entry to /etc/hosts. This seems to be one of those occasions. The reverse can also apply in some situations, too.

It’s generally considered good practice to add such an entry to /etc/hosts — in fact, most Unixish operating systems tend to do this for you as part of their initial configuration (or, if you’re using DHCP, when they obtain a lease).

share|improve this answer

I consider it required but you can get away with it not being specified properly in some cases but in others cases you will find issues where things will not work. I vaguely recall issues with Apache and I can see Tomcat having issues as well.

If the daemon is attempting to reference or resolve the local hostname and it is not specified, it will fail. For example, the hostname is integral to SMTP.

share|improve this answer

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.