Hyper-V and Wireless networking
I have been getting a lot of questions about Hyper-V and wireless networking lately. Specifically, these questions have been from people saying “why does it work sometimes, and not work other times”. To give some background – wireless networking is quite tricky for virtualization. To explain what we actually do here – let me steal from a great post on the Building Windows 8 blog:
The problem
The virtual switch in Hyper-V is a “layer-2 switch,” which means that it switches (i.e. determines the route a certain Ethernet packet takes) using the MAC addresses that uniquely identify each (physical and virtual) network adapter card. The MAC address of the source and destination machines are sent in each Ethernet packet and a layer-2 switch uses this to determine where it should send the incoming packet. An external virtual switch is connected to the external world through the physical NIC. Ethernet packets from a VM destined for a machine in the external world are sent out through this physical NIC. This means that the physical NIC must be able to carry the traffic from all the VMs connected to this virtual switch, thus implying that the packets flowing through the physical NIC will contain multiple MAC addresses (one for each VM’s virtual NIC). This is supported on wired physical NICs (by putting the NIC in promiscuous mode), but not supported on wireless NICs since the wireless channel established by the WiFi NIC and its access point only allows Ethernet packets with the WiFi NIC’s MAC address and nothing else. In other words, Hyper-V couldn’t use WiFi NICs for an external switch if we continued to use the current virtual switch architecture.
Figure 1: Networking between VM and external machine using wired connection
The solution
To work around this limitation, we used the Microsoft Bridging solution, which implements ARP proxying (for IPv4) and Neighbor Discovery proxying (for IPv6) to replace the virtual NICs’MAC address with the WiFi adapter’s MAC address for outgoing packets. The bridge maintains an internal mapping between the virtual NIC’s IP address and its MAC address to ensure that the packets coming from the external world are sent to the appropriate virtual NIC.
Hyper-V integrates the bridge as part of creating the virtual switch such that when you create an external virtual switch using a WiFi adapter, Hyper-V will:
- Create a single adapter bridge connected to the WiFi adapter
- Create the external virtual switch
- Bind the external virtual switch to use the bridge, instead of the WiFi adapter directly
In this model, Ethernet switching still happens in the virtual switch, and MAC translation occurs in the bridge. For the end user who is creating an external network, the workflow is the same whether you select a wired or a wireless NIC.
Figure 2: Networking between VM and external machine using WiFi connection
Unfortunately, this approach does not always work. There are a number of reasons why we see this failing – but the two leading ones are:
- Wireless adapter does not work with our bridge. You can check this by updating drivers, trying different adapters.
- DHCP server does handle requests that have gone through the bridge. Some DHCP servers get confused by DHCP requests coming from guests once they have gone through the wireless bridge.
If wireless networking is not working for you – you can also utilize the Windows support for NAT to get network connectivity. I document how to do this here: https://blogs.msdn.com/b/virtual_pc_guy/archive/2008/01/09/using-hyper-v-with-a-wireless-network-adapter.aspx
Cheers,
Ben
Update 5/2/2016: If you are running Windows 10 check out this blog post https://blogs.msdn.microsoft.com/virtual_pc_guy/2016/05/02/windows-10-hyper-v-and-wireless-a-new-way-to-make-this-all-work/
Comments
Anonymous
February 02, 2015
I have this problem with my Windows 8.1 machine, in my case my wireless router (aka DHCP server) won't hand out IPs to the VMs on the wireless virtual switch, so they get 169.254.x.x addresses. Giving the VMs static IPs is my preferred workaround. I think its great that the wireless functionality in the Windows 8 UI persists very smoothly when you create a wireless virtual switch (the host partition is no longer connecting directly using the Wireless NIC, but it still "feels" like it is!) Thanks for posting, Ben.Anonymous
February 08, 2015
I have not had issues with windows VMS over wireless but have had issues with Ubuntu 12 and up over wireless with DHCP. I had to use a private switch with ics to get it working. On windows 10 it seems to be hit and miss. Sometimes I get an IP for Ubuntu and sometimes not. I have not studied it deeply for a pattern. Anyone else noticed this or have any insights?Anonymous
May 07, 2015
Very nice article in fact. I have a question though. External Virtual Switch, for instance Wireless Network, works fine in my Windows 8.1 Pro with Hyper-V, however, is it possible to make it work with Hyper-V Server 2012 R2 ? The reason I am asking is : I tried installing it in a laptop (I know it's not designed for laptops and stuff but I want to learn more and this is the only place I can install it) then I got a message that my Network adapter wasn't found, but it works fine with the cable plugged in. I don't want to install a Windows Server 2012 for my tests because of licensing costs.Anonymous
May 19, 2015
I'd tried every angle; the "local" vEthernet I configure in win 8.1Pro Client HyperV, sharing the WiFi adapter via ICS, neither of vEthernet IPv4 or IPv6 get internet connection (really limits ability to install any unbuntu etc. that needs to pull pkgs from internet!) used PS to view adapter settings, and ipv4 on the adapter has DHCP disabled, ipv6 has DHCP enabled. I'm not sure this is the issue, just something I saw. I've tried for two solid days and every option discussed on the internet. I'd appreciate any hints to debug this, as the MS info is the same "add local network, share to wifi" ... I've tried with host OS sharing allowed/ not; VLAN enabled/not, really at a point of no ideas of where to tweak HyperV adapter.Anonymous
August 21, 2015
Isn't about time Microsoft pulled it's finger out and stopped passing off inadequate and unreliable network integration and properly supported wireless and Hyper-V?Anonymous
February 29, 2016
Hi Ben,That was a very clearly explained article, I really appreciate the work you put in to this. I was wondering what you envisage the solution will be for this in future Hyper-V implementations? From what you have said here I can see a few options:• The layer-2 switch virtual switch architecture in Hyper-V is replaced with another software switch/router to overcome the limitations of the current switch?• Development or replacement of the Microsoft bridge solution to add options where compatibility is an issue• Or attempt to influence the factors outside of the Microsoft architecture:o Wireless adapters will have to work with the Microsoft bridge to become Windows certified?o All business/home routers which offer DHCP servers will eventually handle requests that have gone through the bridge correctly to be certified. • Something else that I haven’t thought of I would really appreciate your thoughts.Anonymous
October 10, 2016
Interesting article. However in Windows 10 (insider fast 14942) though hyper-v is working great with ethernet, I can't seem to get wireless working on any network.I've created a wireless switch, which, as the article above explains, has caused me to have a wireless bridge as well as the virtual switch but in the guest whilst the virtual ethernet adaptor is visible, no IP address is assiged. A private network works fine. Any ideas?Anonymous
December 28, 2016
If an external switch with bridging doesn't work (worked for me at home and work but not this hotel), use an internal switch and share the connection from the Wi-Fi to it -- winner, winner:https://www.credera.com/blog/technology-insights/microsoft-solutions/using-your-windows-8-wireless-connection-inside-hyper-v/