Virtual PC can't access localhost

1

1

I have IIS running on my local machine and a couple of virtual machines so I can test Internet Explorer 6, 7, & 8. I can't seem to get them to find localhost. Any ideas?

Pardoner

Posted 2011-02-21T17:59:40.517

Reputation: 121

2The localhost in each VM is the VM itself. How did you setup the connection to the internet? In the VM's? Or are they connected at all to the internet? – paradd0x – 2011-02-21T18:02:37.143

They're connected to the internet. In settings I have them set to shared networking (NAT). fyi, I also tried connecting via ip address which didn't work either – Pardoner – 2011-02-21T18:15:08.713

@Pardoner: [Late comment, but] in NAT mode, you cannot access the host from the VM or vice versa. – user1686 – 2011-03-23T20:43:55.083

@grawity: Actually, the way NAT works, usually the guest can access the host. – Hello71 – 2011-03-23T21:47:16.310

@Hello71: Hm, didn't think about that. – user1686 – 2011-03-24T15:38:38.883

@grawity: Basically it works like a router. – Hello71 – 2011-03-24T21:16:37.213

Answers

5

Each virtual machine behaves exactly the same as a real physical computer on a network, so the host should be referred-to by its IP address, not by the name localhost.

If you do not know the host's IP address, enter ipconfig in a command-prompt (cmd). It will be in the entry next to the adapter. The adapter itself depends on the network configuration used for the VMs. If you are not sure which, the simplest solution is to also use ipconfig in the VM to figure-out the adapter.

The IP address of host and VM should agree on the network prefix, which could be 192.168.1.xxx or similar.

harrymc

Posted 2011-02-21T17:59:40.517

Reputation: 306 093

thanks. I figured this would be the case but I'm new to Windows and not sure how to make the machine available to the network. Can you point me in the right direction? – Pardoner – 2011-02-22T00:53:11.637

2

You most likely have an active firewall.

That's why I had the exact same problem with my Virtual PC IE6 client...

Added a new inbound rule for port 80/443, and now I can access my IIS hosted websites on my local PC just fine.

To do this (on Windows 7), go to run, and type "windows firewall", then click on "Windows Firewall with Advanced Security"

Select "Inbound Rules" on the left, and then click New Rule.. on the right, then follow the wizard.

user73107

Posted 2011-02-21T17:59:40.517

Reputation: 61

And that is why while using Win 7 and accessing the network I choose Work Network option since it disables most of the Windows Firewall rules and I can use whatever else to protect myself. – Darius – 2011-03-23T19:11:15.200

0

For me, I had to edit my hosts file ("C:\Windows\System32\drivers\etc\hosts", requires Admin rights) and add an entry associated with my route IP like:

192.168.1.1      laptop

Then create a binding for laptop:50000 in IIS. I chose a high port like 50000 to make it easy to present multiple sites to Virtual PC (Windows security gets more meddlesome in the 4-digit and below ports).

I opened that port in Windows Firewall.

I made sure Virtual PC had only one Network Adapter setup, my Wireless Adapter, so it would get a real IP from my router.

That did it - any browser in WinXP on Virtual PC can access IIS sites I setup this way.

Chris Moschini

Posted 2011-02-21T17:59:40.517

Reputation: 271