LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   /etc/hosts and routers (https://www.linuxquestions.org/questions/linux-newbie-8/etc-hosts-and-routers-21582/)

robeb 05-22-2002 06:55 PM

/etc/hosts and routers
 
How can I configure my router in terms of the /etc/hosts file? For example, if my router's name is "mybox" then the /etc/hosts file would read "mybox.mydomain.com". So, if I have 2 IP's then which IP should be assinged mybox? Should both be assinged mybox?

- Thank you

crabboy 05-24-2002 10:11 PM

If the machine has two network cards then it will most likely have two IP addresses. One for the external network and one for the internal.

geoffm33 05-24-2002 11:05 PM

An entry for localhost using a FQDN in the /etc/hosts file is to save your box from making a DNS request to resolve itself. I suppose in the instance your router wanted to do a reverse lookup of itself, it would help to have your public IP address listed in the /etc/hosts file.

This is only if I understood your question correctly!

Noerr 05-25-2002 02:23 AM

putting ip/name pairs in hosts file makes your box resolve all ip's instantly and it is not necessary to use fqdn ie you can put something like
myweb 1.2.3.4

and then you can simply ping/ssh/ftp.. your webserver by:
ping myweb
It is nice to put all local and known ips into hosts so you see nicely who logged in to your box + easier to access their machines

geoffm33 05-25-2002 09:47 AM

I agree Noerr, I think my answer was misleading.

I think the question was which IP (public or private) should robeb put in his router's /etc/hosts file on his router. I don't think you need an entry for your router on your router in /etc/hosts, other than 127.0.0.1 mybox.mydomain.com

You definitely do not want to put both IP's in /etc/hosts because that file is read top to bottom so the first entry that matches wins.

Noerr 05-25-2002 02:51 PM

i always put 127.0.0.1 localhost
to serve its purpuse (if any)


All times are GMT -5. The time now is 01:06 AM.