Saturday, October 24, 2015

How to install the loopback adapter in Windows 8

In earlier versions of Windows, Microsoft included a loopback adapter. This was a virtual network interface that essentially you could use for network testing but without having a physical network card. In Windows 8 this device is a little trickier to install. Let me show you how to install the loopback adapter and how I’m using it in Hyper-V.
Contents of this article

Starting the Add Hardware Wizard

At first you would think to merely go to Devices under Control Panel and add the adapter. Sadly, no. At least not that I could find. The best approach seems to be to launch the Add Hardware Wizard. Click Windows Key+R and run hdwwiz.
Starting Hardware Wizard
Starting the Hardware Wizard
Click Next.
Manually install hardware
Manually install hardware
Select the option to manually install hardware and proceed.
Select network adapters
Select network adapters
Scroll down to the network adapters section and select it as I did in the screenshot above. Click Next.
Microsoft KM-TEST Loopback Adapter
Microsoft KM-TEST Loopback Adapter

Select Microsoft for the manufacturer and scroll down until you find the Microsoft KM-TEST Loopback Adapter. That is the new name in Windows 8.
Install Microsoft KM-TEST Loopback Adapter
Install Microsoft KM-TEST Loopback Adapter

Click Next to install it. It shouldn’t take very long and not require a reboot.
Loopback Adapter installed
Loopback Adapter installed

After you finish installing, you should see the new adapter under Network Connections.
Loopback adapter under Network Connections
Loopback adapter under Network Connections

At this point, you could configure the adapter’s properties to suit your needs.
Configure network adapter
Configure network adapter

Which brings me to why I even bothered with this.

Configuring with Hyper-V

I run Hyper-V on my Windows 8 laptop for development, testing and training. All my virtual machines are on the same virtual switch exposed to the physical network. In my office I can easily reach virtual machines from the host and vice versa, which I need to be able to do. The challenge is that when I am out of the office, say presenting at a conference, if I don’t have a network connection, my virtual machine networking no longer works the way I need it. Yes, the VMs can still communicate with each other, but I lose the ability (required in my case) to communicate between the host and guest. That’s when I realized the loopback adapter could help.
Originally my Hyper-V virtual switch was connected to my Ethernet port. Now I’m going to connect it to the loopback adapter. In the Hyper-V management console click on Virtual Switch Manager and then selected my virtual switch.
Select virtual switch
Select virtual switch

From the drop down list I select the loopback adapter and click OK. You might be prompted about brief network interruptions so take that into account when making this change.
At this point, this doesn’t change anything for the virtual machines and makes no difference when I’m connected to a network. However, one downside is that my virtual machines no longer can reach the Internet or my physical work network. So the next step is to bridge.
In Network Connections, using the Ctrl key I click on the Hyper-V adapter and my physical network adapter, then right click and choose Bridge.
Network Bridge
Network Bridge

I right-click the Network Bridge and assign it an IP configuration in a range that my virtual machines are expecting.

Net results

If I am following the network paths that I’ve created correctly when I am disconnected from a physical network, the loopback adapter gives me a network interface with an IP address. Because the loopback adapter is bound to the Hyper-V virtual switch, my virtual adapter gives me network access from the host to the virtual machines and vice versa. One other item I have to remember though is that in this scenario Windows considers the network public which means I need to turn the firewall off. But since I’m not connected to any physical network, that’s not a problem. And when I’m in the office on my physical network, the virtual switch is bridged with the physical interface so all of my virtual machines can access the Internet.
I’m certainly not implying that this is the only or best use of the loopback adapter. But if you have the need for a test adapter, it is there in Windows 8.

Thanks to Jeffery Hicks  a multi-year Microsoft MVP for his sharing!

No comments:

Post a Comment