Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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:

127.0.0.1 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.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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
127.0.0.1       localhost.localdomain localhost
127.0.0.1       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).

share|improve this answer
    
Thanks. I really appreciate your clear explanation and especially direct answers! –  hpy Jul 16 '11 at 20:13
add comment

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.