Virtual Network with Internet Access Using Windows 7 Virtual PC and the Loopback Adapter

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:

  1. Install the loopback adapter on the host and rename the new network connection from e.g. Local Area Connection 2 to e.g. Loopback.
  2. Change your original local area connection (not loopback) to allow Internet connection sharing. Set Home networking connection to Loopback.

    image 

    You will probably get a dialog similar to this:

    image

    Make note of this IP address. Your network adapters for the virtual network should use addresses in the same subnet (192.168.137.x).

  3. Configure your virtual machines to have one network adapter, and select Microsoft Loopback Adapter.

    image

  4. Inside the virtual machines, configure the network adapter to use static IP addresses, e.g.:

    image

    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.)

  5. If you (like me) have a test domain, set DNS suffix for this connection on the Advanced –> DNS tab.

    image

  6. You probably want to configure the custom domain on the loopback adapter on the host as well:

    image

Advertisements

3 thoughts on “Virtual Network with Internet Access Using Windows 7 Virtual PC and the Loopback Adapter”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s