Tuesday, December 16, 2014

Hyper-V: Internet Connection Sharing (ICS) with Hyper-V Virtual Switch

I'm running Hyper-V on a new machine with Windows 8.1 Update 1 and updated with the latest patches. I'm running in to issues sharing internet access from my wireless network with my VM's. This post describes a solution which worked in my case.

Internet access for Hyper-V virtual machine

To give your VM's access to the internet through your computer there are multiple options

  1. Create an external switch and let the guest system connect to the actual network
  2. Create an internal switch and share your internet connection with that Virtual Switch

I prefer option 2 and therefore created a Virtual Switch and shared my Wifi connection with that Virtual Switch.

But for some reason the guest system did not get access to the internet, but did get a DHCP lease from the interface I shared with the Virtual Switch to which the VM was connected.

Searching through the internet only resulted either in sharing your internet with an hosted network on WiFi (adhoc) or describing setting up Internet Connection Sharing (ICS) as it was supposed to work.

Troubleshooting

The Wi-Fi Hosted Network brought my to the idea that infact the hosted network was also a way to let incoming connection route through the cabled interface of the host.

The command (elevated) to see whether your WLAN driver supports Hosted Network is:
netsh wlan show driver


So what if this command also worked to show details about the LAN interface?
Nope...that command is not supported.

But what DOES work is showing the available LAN interfaces with the command:
netsh ip show interfaces

This showed no information about LAN interfaces, but a statement about the Wired AutoConfig Service.
Aha, currently i'm not connected to a LAN. Actually I always use Wifi whenever possible.

Enable the Wired AutoConfig service through services.msc


After enabling this service, I got some results back from netsh.


WLAN/Wi-Fi ICS with Virtual Switch - another try

Now let's try that second method again to share internet access. (By the way, this also solved another issue on my Hyper-V host when  i want to create Virtual Switches in the first case.)

Follow the steps:
  1. Create an internal virtual switch through the Virtual Switch Manager (give it a descriptive name like vSwitch - Shared)
  2. Share your active internet connection with that vSwitch

  1. Add a network adapter to your VM which connect to that vSwitch
  2. Verify internet access on the guest OS. Yeeh!

Cause?

What's the cause of this? I think it's maybe because the Wired AutoConfig Service is possibly triggered when using a physical interface and I use a WiFi connection. Haven't tested this yet though.

But after changing the Windows display language from Dutch to English (US) it also seems to be working. Hhmm?
Maybe this is caused by a specific configuration on my system, but if this post works for you, than I'm glad I shared this.