I am setting up a RHEL-based server that is associated with dynamic DNS from DynDNS, with a domain of, say, "abc.dyndns.org" that is dynamically updated with the server's IP address.

I have read that in order to ensure access to your server's services, you need to have at least the following in your /etc/hosts: localhost.localdomain localhost

xxx.xxx.xxx.xxx redhatbox.yourcompany.com redhatbox

Where "xxx.xxx.xxx.xxx" is whatever IP address your server has, and "redhatbox" would be the name of the computer. So here are my questions:

(1) Because my server has an IP that is dynamically assigned by my ISP's DHCP, there is no one IP I can put in place of xxx.xxx.xxx.xxx, what should I do in this case?

(2) Should I simply replace "redhatbox.yourcompany.com" with my DynDNS domain "abc.dyndns.org"? And replace the "redhatbox" alias with "abc"?

If anyone can explain all this for a novice like me that would be great. Thank you very much for your detailed answers and patience.

1 Answer 1


Some context:

When a program asks your machine to resolve a hostname into a IP address it looks into your /etc/hosts and, if not found, it then makes a DNS query.

You don't need to keep a non-loopback IP address on it. You can just usually keep the localhost entries and an alias.

See, that's my /etc/hosts contents:

[braga@coleman ~]$ cat /etc/hosts       localhost.localdomain localhost       coleman.jazz coleman
::1     localhost6.localdomain6 localhost

coleman.jazz or coleman (named for the musician, Ornette Coleman) is just an alias for my machine.

Direct answers:

  1. Just leave it out.

  2. You can replace it wherever you want to. it's just an alias. You can even replace it with www.google.com (and www.google.com on your machine will point up to your own machine).

  • Thanks. I really appreciate your clear explanation and especially direct answers!
    – hpy
    Commented Jul 16, 2011 at 20:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .