View Single Post
  #5  
Old 4th September 2007, 21:10
chuckl chuckl is offline
Senior Member
 
Join Date: May 2007
Location: Uxbridge, Middlesex, UK
Posts: 166
Thanks: 1
Thanked 20 Times in 20 Posts
Default

There's usually no right or wrong in this stuff, just 'does it do what you want it to do?'

A typical home or small business setup would be as follows:

You have a broadband internet connection. You either have a static IP address assigned by your ISP, or use DnyDNS or similar to keep track of any EXTERNAL IP changes.

If you have an assigned iP your Belkin router should be set with this as it's external internet IP address.

On the 'other side' of the Belkin you have your 'private' network. This usually uses IP address ranges that are non routable - 192.168.X.X or 10.10.X.X or similar.

Your Belkin needs one of those addresses to communicate with the rest of your network and to pass internet traffic. It would usually be a fixed address, as otherwise your gateway would change unpredictably, losing you your internet connectivity. Note that this is not the same as the external internet IP.

The unit is also often set up as a DHCP server to assign IP addresses in the non routable range you have chosen to other machines on your private network, and to inform them that it is the gateway etc.

In the case of your server, it also needs a fixed IP, for the same reason as the Belkin - otherwise it's a moving target.

Most modem/routers also have a DMZ machine setting, where you would specify a target IP address for any incoming traffic - web traffic, mail etc., and here you would enter your server IP.

Your other machines can use DHCP or be configured with fixed addresses, makes no difference.

Where the problems occur is when you type the url of a site hosted on your server from a private network machine. Your machine will query a DNS server out on the internet, whic will return the external IP of your router, i.e. the internet address of that website.
But you are on the private network, so what usually happens is that your Belkin thinks that you want to configure it, and pops up a logon prompt.

To prevent that you use a hosts file entry. The idea is that before issuing a DNS query, your machine will check it's hosts file. If it finds an entry there for the url it is looking for, it will use that rather than DNS. As long as that IP address is the local private IP of the server, all will work as intended.

There are other ways of achieving this with DNS zones, but I think this is slightly simpler.

To put some numbers to it, lets say you are using 192.168.0.X addresses for your network.
You set your Belkin internal IP to 192.168.0.1 and the DHCP on the Belkin to issue addresses from 192.168.10 to 192.168.0.100, or 200 or whatever takes your fancy, and the gateway address to 192.168.0.1
Set the server IP to 192.168.0.2, and on the other local machines you edit the hosts files to add an entry like

192.168.0.2 www.mydomain.com

If you have multiple domains on the server, simply add additional entries

192.168.0.2 www.myotherdomain.com
192.168.0.2 www.yettanothermydomain.com

etc.

Note that www.mydomain.com is NOT the same as mydomain.com, the are 2 entries.

Also note that if you are editing the hosts file on a Windows box, use a command prompt, navigate to the windows\system32\drivers\etc folder and edit hosts with the commandline edit program. i.e. c:\edit hosts
Notepad, Wordpad and most of the like will immediately add a .txt extension to the filename, and you will spend the next week wondering why it does not work.
Reply With Quote