Testing IIS websites locally over virtual machines
November 16, 2009 4:29 PM   Subscribe

I'm running IIS on Windows 7 to test a website locally. How can I access my local site through my virtual machines?

I'd like to test my website locally across multiple browsers before putting them into our staging environment. I have two virtual XP machines set up on my Windows 7 laptop, with various browser versions on each. I want to be able to see my locally-hosted site on these virtual machines.

For example, I have http://site.leia.dev pointing to my folder of files on my Windows 7 laptop. I can view that URL in my Windows 7 browsers. In my IIS settings for the site, I have the bindings for "all unassigned" IP addresses on port 80 to use site.leia.dev as the host name.

Is there a network setting I'm missing to make my virtual machines recognize IIS as a server? Is there a specific IP address I should use instead of my host name?
posted by LeiaS to Computers & Internet (4 answers total) 1 user marked this as a favorite
 
I would use your IP address unless there's some reason you need to use DNS. In that case you need to make sure that DNS is setup correctly on the other machines. To get the IP from the Win7 box, cmd -> ipconfig.
posted by geoff. at 4:40 PM on November 16, 2009


Totally a guess: point the VM's browser to the host machine's IP address.
E.g. opening http://192.168.0.101/ should get your website's index.htm page (if the host is at 192.168.0.1 of course)
posted by anadem at 4:41 PM on November 16, 2009


If you're using the most common arrangement for VM networking, each of your VMs will be behind NAT, and will be running in its own little network world; from the VM point of view, your host machine is somewhere out there in the cloud.

That means that the usual internal methods that Windows uses to associate a local machine's host name with its IP addresses are not available to the VMs. They can use those methods to associate their own names with their own IP addresses, but they need to do the same kind of lookup to find the IP address of the machine that hosts them as they would do for any other machine in the cloud.

So you have some choices. From simplest to most complicated: you can (a) access your web server via its IP address, rather than by name (b) make an entry in each VM's HOSTS file (usually at C:\WINDOWS\system32\drivers\etc\HOSTS) that associates a name with the server's IP address or (c) fiddle about with DNS. This last option will range from really easy to moderately annoying depending on how your VM hosting software deals with DNS.
posted by flabdablet at 5:13 PM on November 16, 2009


If you have the VM set up to use NAT internally, it will take the internal IP of your host PC, then create a NAT network under that again (such as 10.0.0.x network), so you're effectively being NAT'd twice inside your VMs. You don't want this.

The VM should be set up to bridge into your main internal network. This way, it should be able to access the entire internal network (usually 192.168.x.x).
As an example for this, I modified a XP vm in VirualBox, added a network interface (kept the original NAT interface just in case), and told this new interface to bridge to my primary hardware NIC. When it started up, it got a DHCP address from my main router and I was able to connect to my local file server.
posted by ijoyner at 6:53 PM on November 16, 2009


« Older ebook or ubook   |   Nobody light a match! Newer »
This thread is closed to new comments.