NAT Hostname Limitations

Jan 25, 2005 16:49


Here's something I discoved recently:

Under a normal NAT (or IP Masquereding) situation, the external (public) IP address of the router cannot be reached from within the network. In other words, my machines that are inside the Centre cannot access cscc.homeunix.net, but must instead access it's associated private hostname. This is very annoying, as it breaks my blog, and a few other things when I am using one of my home computers.

However, I've found that I can get past this limitation by adding an alias to the /etc/hosts database. Right now, my webserver and gateway is called faramir, so add to /etc/hosts the following lines:

127.0.0.1 localhost 172.16.0.9 sauron.cscc sauron 172.16.0.7 faramir.cscc faramir cscc.homeunix.net
Now, I can access cscc.homeunix.net from inside the local network. Without this I'd have to use faramir.cscc, instead.

For this to work, files has to be listed before dns in nsswitch.conf (as it is called under Linux, *BSD, and Solaris. Other Unices call it something different).

Under Windows 95/98/ME, the alias can be added to the c:\windows\hosts. Normally, Windows includes a sample file called hosts.sam. Windows XP (and perhaps 2000 & NT4) has two hosts files in different locations. I'd modify both just to be certain.
Previous post Next post
Up