Hosts File resolution
am 15.11.2007 17:43:00 von Stortman
I have recently configured a Win Server 2003 box as a development web server
on my small home based LAN behind an ADSL modem/router/firewall. All boxes on
my LAN have fixed internal IP addresses. Under IIS 6 I have created 4 web
sites. All share the same internal IP number. My router is configured to
route all external traffic coming in to my public IP address to my web
server. All my public web site names will resolve to the same external IP
address. Initially, I do not want to set up my own DNS server. I want to use
the Hosts file on my XP Pro to resolve the web site requested by my browser
IE 7. Firstly, I configured Hosts to resolve the first web site with an entry
[192.168.10.2 example.co.uk] and this works fine if I type in
example.co.uk as the url. But when I try [192.168.10.2 www.example.co.uk]
this does not work. Neither does it work if I substitute the external
address. As I understand from the various explanations on this topic, my
browser will try to resolve using Hosts before going off to find a DNS
server. Have I misunderstood? I want to type in www.example.co.uk and let
Hosts resolve to my web server without going out to DNS. I do intend to set
up my own DNS but I want to flog Hosts a bit first!
Re: Hosts File resolution
am 15.11.2007 18:11:59 von Chris M
Stortman wrote:
> I have recently configured a Win Server 2003 box as a development web server
> on my small home based LAN behind an ADSL modem/router/firewall. All boxes on
> my LAN have fixed internal IP addresses. Under IIS 6 I have created 4 web
> sites. All share the same internal IP number. My router is configured to
> route all external traffic coming in to my public IP address to my web
> server. All my public web site names will resolve to the same external IP
> address. Initially, I do not want to set up my own DNS server. I want to use
> the Hosts file on my XP Pro to resolve the web site requested by my browser
> IE 7. Firstly, I configured Hosts to resolve the first web site with an entry
> [192.168.10.2 example.co.uk] and this works fine if I type in
> example.co.uk as the url. But when I try [192.168.10.2 www.example.co.uk]
> this does not work. Neither does it work if I substitute the external
> address. As I understand from the various explanations on this topic, my
> browser will try to resolve using Hosts before going off to find a DNS
> server. Have I misunderstood? I want to type in www.example.co.uk and let
> Hosts resolve to my web server without going out to DNS. I do intend to set
> up my own DNS but I want to flog Hosts a bit first!
Is the IIS site for that address perhaps only configured with a host
header for example.co.uk and not www.example.co.uk?
--
Chris M.
Remove pants to email me.
Re: Hosts File resolution
am 15.11.2007 18:21:49 von Anthony Jones
"Stortman" wrote in message
news:B9E9790F-79AE-4C0E-8867-AC19808DF2DA@microsoft.com...
> I have recently configured a Win Server 2003 box as a development web
server
> on my small home based LAN behind an ADSL modem/router/firewall. All boxes
on
> my LAN have fixed internal IP addresses. Under IIS 6 I have created 4 web
> sites. All share the same internal IP number. My router is configured to
> route all external traffic coming in to my public IP address to my web
> server. All my public web site names will resolve to the same external IP
> address. Initially, I do not want to set up my own DNS server. I want to
use
> the Hosts file on my XP Pro to resolve the web site requested by my
browser
> IE 7. Firstly, I configured Hosts to resolve the first web site with an
entry
> [192.168.10.2 example.co.uk] and this works fine if I type in
> example.co.uk as the url. But when I try [192.168.10.2
www.example.co.uk]
> this does not work. Neither does it work if I substitute the external
> address. As I understand from the various explanations on this topic, my
> browser will try to resolve using Hosts before going off to find a DNS
> server. Have I misunderstood? I want to type in www.example.co.uk and let
> Hosts resolve to my web server without going out to DNS. I do intend to
set
> up my own DNS but I want to flog Hosts a bit first!
The HOSTS file is very basic; it maps the exact text of the name (case
insensitive) to an IP address and thats all.
If you wanted example.co.uk and www.example.co.uk to resolve to
192.168.10.2 then you need to enter both into the HOSTS file.
You would also need both on as host headers on the website that you want to
responding. (Although normally you would create a different website for
example.co.uk and have it redirect to the www site).
If you want 192.168.10.2 to respond as the web site then you need that IP
configured against your website in IIS with a blank host header. If that is
the only IP address the machine has then that is the only website that will
get returned using an IP address.
--
Anthony Jones - MVP ASP/ASP.NET
Re: Hosts File resolution
am 15.11.2007 18:51:00 von Stortman
Thanks Chris. Pants off! You are right . I had entered a second entry for
www.example.co.uk in the IIS Add/Edit Web Site Identification window and
saved it using the OK button. However, I may not have then saved the whole
Properties window using its OK button when I was finished. When I checked I
had no second entry to record the www form of the host header. It was gone!
"Chris M" wrote:
> Stortman wrote:
> > I have recently configured a Win Server 2003 box as a development web server
> > on my small home based LAN behind an ADSL modem/router/firewall. All boxes on
> > my LAN have fixed internal IP addresses. Under IIS 6 I have created 4 web
> > sites. All share the same internal IP number. My router is configured to
> > route all external traffic coming in to my public IP address to my web
> > server. All my public web site names will resolve to the same external IP
> > address. Initially, I do not want to set up my own DNS server. I want to use
> > the Hosts file on my XP Pro to resolve the web site requested by my browser
> > IE 7. Firstly, I configured Hosts to resolve the first web site with an entry
> > [192.168.10.2 example.co.uk] and this works fine if I type in
> > example.co.uk as the url. But when I try [192.168.10.2 www.example.co.uk]
> > this does not work. Neither does it work if I substitute the external
> > address. As I understand from the various explanations on this topic, my
> > browser will try to resolve using Hosts before going off to find a DNS
> > server. Have I misunderstood? I want to type in www.example.co.uk and let
> > Hosts resolve to my web server without going out to DNS. I do intend to set
> > up my own DNS but I want to flog Hosts a bit first!
>
> Is the IIS site for that address perhaps only configured with a host
> header for example.co.uk and not www.example.co.uk?
>
>
> --
> Chris M.
>
> Remove pants to email me.
>