How Do You Solve the Linux Error “hostname: Name or service not known”?

Problem scenario
You run hostname -f and you get this error: "hostname: Name or service not known"

How do you solve this problem?

Solution
Do these things in this order:

  1. Verify you have the hostname in the /etc/hostname file.
  2. Verify the name above matches what is in /etc/hosts for the local IP address.
  3. Try rebooting the server.

Optionally, to read more about how the results are determined, see click here.

Leave a comment

Your email address will not be published. Required fields are marked *