Share via


Configuring NAT via using the Microsoft Loopback Adapter and Internet Connection Sharing

In previous posts I have mentioned using the Microsoft Loopback Adapter for advanced networking scenarios. Today I am going to talk about how to team up the Microsoft Loopback Adapter with the Internet Connection Sharing capabilities of Windows to construct a NAT network solution. This is very handy to do with Virtual Server - which has no built in NAT solution - and it is even useful for Virtual PC as it provides a more flexible NAT solution than the built in shared networking functionality (such as the capability for virtual machines to network with each other and the host computer).

The directions on how to install the Microsoft Loopback Adapter under Windows XP are as follows:

  1. On the host operating system go to 'Control Panel'
  2. Go to 'Add Hardware'
  3. In the 'Add Hardware' wizard, click 'Next'
  4. When the 'Is the hardware connected?' page appears, select 'Yes, I have already connected the hardware', and then click 'Next'
  5. In the 'Installed hardware' list, select 'Add a new hardware device' and then click 'Next'
  6. In the 'What do you want the wizard to do?' list, select 'Install the hardware that I manually select from a list (Advanced)' , and then click 'Next'
  7. In the 'Common hardware types' list, click 'Network adapters' , and then click 'Next'
  8. In 'Manufacturer' list, select 'Microsoft'
  9. In the 'Network Adapter' list, select 'Microsoft Loopback Adapter' , and then click 'Next' twice
  10. In the 'Completing the Add Hardware Wizard' page, click 'Finish'

Once you have done this you will then need to enable Internet Connection Sharing (ICS). The catch here is that you need to enable ICS on the network interface that you want to use to access the Internet - not the Microsoft Loopback Adapter:

  1. On the host operating system go to 'Control Panel'
  2. Go to 'Network Connections'
  3. Right click on the network connection that you use for Internet connectivity and select 'Properties'  
  4. Click on the 'Advanced' tab
  5. Check the option to 'Allow other network users to connect through this computer's Internet connection'
  6. If you have multiple network adapters you will need to also specify that you are sharing the Internet connection with the Microsoft Loopback Adapter.
  7. Click 'OK'

A couple of things to know at this stage:

  1. Under Windows XP this will cause your Microsoft Loopback Adapter to be hard configured to use '192.168.0.1'. This is problematic if your external network is configured to use the 192.168.0.xxx subnet - but unfortunately there is nothing that you can do about this except to change your physical network settings (I have moved my physical home network to 192.168.1.xxx for exactly this reason).

  2. Under Windows Server 2003 it is possible to change the IP address and subnet used on the Microsoft Loopback Adapter when ICS is enabled.

  3. ICS provides DHCP services as well - so virtual machines connected to the Microsoft Loopback Adapter do not need to have static IP addresses configured.

Cheers,
Ben

Comments

  • Anonymous
    October 04, 2005
  1. Isn't this post a straight cut-n-paste from the Virtual Server help? I disticntly remember performing exactly this when I was trying out VS, after getting bummed out that it doesn't have built-in NAT.

    2. What doesn't Virtual Server have shared folders like Virtual PC? This is really useful for someone like me, who uses VS to test networking-related stuff, and therefore doesn't always have network connectivity to the host.

    3. How do you change the IP/subnet of the ICS-assigned addresses? I couldn't find it.
  • Anonymous
    October 04, 2005
    Hi Jonathan,

    1) Actually no - I made this post because I was quite surprised to find out today that this configuration is not documented 'end-to-end' anywhere.

    2) Shared folders was not included in Virtual Server due to anumber of security concerns

    3) With Windows Server 2003 all you need to do is to change the IP address on the Loopback adapter.

    Cheers,
    Ben
  • Anonymous
    October 04, 2005
  1. Well, I managed to do it just by reading the .chm, and I've never even heard of the loopback adapter or setup ICS before. But I may just be more versed in networking than some...

    2. I suspected as much.

    3. Really? And ICS' DHCP will just distribute addresses from the adapter's subnet? That's cool.
  • Anonymous
    October 04, 2005
    I knew the ICS IP:s could change cause I've done it myself a while ago (due to conflict with WAN adresses).
    After searching the net I found this page describing how to do it (though there seems to be a bug in defining DHCP-range)
    http://www.wown.com/j_helmig/icsadcnf.htm
  • Anonymous
    October 05, 2005
    On both Windows XP and 2003 I have changed the IP address of the loopback adapter in network properties. That wasn't a problem. But when I tried enabling Internet Connection Sharing, that forced the loopback adapter's IP address to change to the same as a physical external machine. (Which physical external machine? The one that provides connectivity for viewing Microsoft's web site, activating a guest OS, sending crash dumps to Microsoft, etc.) So I had to give up. In Windows 2003 I could use Routing and Remote Access to set a non-conflicting subnet and get a guest connected, but in Windows XP there's no way.

    I think the help for Virtual PC does give most of those steps from beginning to end, even if the help for Virtual Server doesn't.

    Meanwhile why did plain old NAT stop working in Virtual PC? From your posting I understand that it was removed from Virtual Server (though I wonder why), but why did it stop working in Virtual PC? When the real machine is running Windows XP there no longer seems to be any way to establish connectivity for a guest.
  • Anonymous
    October 10, 2005
    Heya VPC guy...I found this post and was hoping that you might be able to provide a suggestion for my scenario...

    What I've got is a machine running Virtual Server 2005 on it...with one network adapter and 1 loopback adapater. The machine is unjoined to any domains. There is an virtual network setup to use the loopback adapter so that VM's can get an IP address and talk to each other.

    There are 2 VM's running, ones a DC and the other a member server joined to the virtual DC.

    The host is capable of getting to domain resources by providing a domain authenticated user's credentials, however the VM's are not.

    So my question is what do I need to do in order for the VM's to be able to access network resources, while still remaining isolated?

    Thanks. :)
  • Anonymous
    October 10, 2005
    I'll try to help Chris Davidson since I've done more than half of the steps that I think are necessary for this.

    Assuming that the real machine is running a Windows Server OS, enable Routing and Remote Access on the real machine to forward packets between the VMs and the real network. Next, when a VM attempts to access a share on some real machine in the domain, there will be a prompt for authentication. The user will have to authenticate as a domain account that has privileges, in the following manner:
    Username: MyDomainSomeDomainUsername
    Password: SomeDomainUsername's domain password
  • Anonymous
    November 02, 2005
    Well we tried to do this but did not have any success. The IP address on the external adapter is not a 192.168.x.y but a routable address. Could this be causing a problem?

    What we get is the ability to see the host from the guest but not the rest of the internet. Any ideas?
  • Anonymous
    December 07, 2010
    I want to share host and guest machine. Following is the detail:
  1. Host OS windows 7 Enterprise
  2. Guest OS Windows 2003 Enterprise installed in VPC.
  3. Microsoft Loopback adapter installed on both Host and Guest machine Please guide me how do connect/share host-guest machine. Regards,
  • Anonymous
    December 10, 2010
    The comment has been removed

  • Anonymous
    September 10, 2011
    Is there any way to change nat type using ics from an android tether app

  • Anonymous
    September 19, 2011
    Will all this work on Windows CE in Microsoft Virtual PC 2007?

  • Anonymous
    September 02, 2013
    how to ping virtual windows xp from both host and external machines where virtual xp  doesn't appear in the network having separate ip address

  • Anonymous
    February 07, 2014
    hi there, i am struggling with connecting my 2003/xp virtual system with my host computer. i tried with IP change adding the loopback in all the virtual pc as well at the host computer but all failed. Please advice if there is any way to get communication between Vpc n host computer. Will be appreciated if you can revert me on nirajsec@gmail.com thanks in adv. niraj.