LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   setup domains in /etc/hosts (https://www.linuxquestions.org/questions/linux-networking-3/setup-domains-in-etc-hosts-468664/)

tommy916 07-28-2006 04:31 PM

setup domains in /etc/hosts
 
I have a new dedicated server. In the file /etc/hosts

Should I set to

Code:

127.0.0.1    yourdomain.com  localhost.localdomain  localhost
or

Code:

127.0.0.1          localhost.localdomain  localhost
123.456.789.1      yourdomain.com


tronayne 07-28-2006 05:19 PM

What you're doing in /etc/hosts is adding the name and address of other systems that this system can get to by name (with ssh and the like). You do not want to add anything to the localhost line (never ever, just leave it be). So, if your other system is named foo.bar, your hosts file would look like this:

127.0.0.1 localhost
123.456.789.1 foo.bar foo

That way you can refer to foo.bar as simply foo; e.g., ssh foo, or with the full name, ssh foo.bar


All times are GMT -5. The time now is 12:49 AM.