Sometimes I have the need to have two or more virtual machines connected in a virtual network when developing applications. You can set the network to Internal Network in Windows 7 Virtual PC settings and the virtual machines can communicate with each other, but they cannot communicate with the host. To fix that, and enable physical LAN/Internet access from the guests, you can use Microsoft’s loopback adapter. Here is how to set it up:
- Install the loopback adapter on the host and rename the new network connection from e.g. Local Area Connection 2 to e.g. Loopback.
- Change your original local area connection (not loopback) to allow Internet connection sharing. Set Home networking connection to Loopback.
You will probably get a dialog similar to this:
Make note of this IP address. Your network adapters for the virtual network should use addresses in the same subnet (192.168.137.x).
- Configure your virtual machines to have one network adapter, and select Microsoft Loopback Adapter.
- Inside the virtual machines, configure the network adapter to use static IP addresses, e.g.:
In this case, I have a virtual machine which is Active Directory domain controller for my test domain with address 192.168.137.101 – that is why I have that address as preferred DNS server. The alternate DNS server is the address of the host on the virtual network. The 192.168.137.101 machine will resolve host names of the test domain and the host will resolve names of other domains. (On the AD DC, preferred DNS server is set to the computer itself, i.e. 127.0.0.1.)
- If you (like me) have a test domain, set DNS suffix for this connection on the Advanced –> DNS tab.
- You probably want to configure the custom domain on the loopback adapter on the host as well: