/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 |
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.
|
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! |
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 |
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. |
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. |