Internet access for Hyper-V virtual machineTo give your VM's access to the internet through your computer there are multiple options
- Create an external switch and let the guest system connect to the actual network
- 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.
TroubleshootingThe 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 tryNow 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:
- Create an internal virtual switch through the Virtual Switch Manager (give it a descriptive name like vSwitch - Shared)
- Share your active internet connection with that vSwitch
- Add a network adapter to your VM which connect to that vSwitch
- Verify internet access on the guest OS. Yeeh!
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.