On 27 Nov 2005, in the Usenet newsgroup comp.os.linux.networking, in article
<(E-Mail Removed) .com>,
(E-Mail Removed)
wrote:
>All machines behind the router show their 10.8.33.X address.
Simple solution - at work, call them by the 'Internet' name that
matches up with the real domain. AT HOME, refer to them by a
different name - that maps to the 10.8.33.X address.
>But the problem is for my Windows and Mac laptops. Both of them I take
>out of the house and use on other networks, in that case I have had to
>add or remove the line in the /etc/hosts file.
Your domain is "foo.bar", and you connect to
www.foo.bar. That probably
resolves on the internet, so leave it alone. AT HOME. the actual web
server is on "10.8.33.11". In all of your hosts files, add a line
10.8.33.11
www.foo.home
Now at work, you connect to
www.foo.bar, and the kernel will look in
/etc/hosts (no, it's not here), and then ask the DNS server, and get
the external address. At home, you connect to
www.foo.home and the
kernel will look in /etc/hosts and find the local address (it won't
therefore bother a DNS server asking about a non-valid hostname).
We have a few hosts (generally laptops used as work stations) that move
from one network to another. When they boot, they wait at a prompt to
ask what network they are on (this can also be done by tweaking runlevels
for example - 4 for GUI at home, 5 for GUI at work), and therefore assume
the correct identity for the network they are attached to.
Old guy