Friday, February 13, 2015

Windows 8.1 laptop based Hyper-V virtual machine with internet access thru WiFi

Laptop based Hyper-V virtual machine with internet access thru WiFi

I have a laptop (Lenovo T540p) with Windows 8.1 64 bit, which has wifi and ethernet connectivity
I want to run a Windows XP pro 32bit virtual machine inside a local Hyper-V
I want the XP virtual machine to be able to access the internet, both when laptop is connected to wired ethernet, and when it is on wifi

The request is a bit tricky because a simply bridged connection is not going to work, since link establishment over WiFi requires a pre-connection protocol negotiation, with encryption etc.



Here are the steps I made:

1. Enable Hardware virtualization support in laptop BIOS (it was off by default)

2. Enable MS Windows Hyper-V support, activating the corresponding windows feature (Ctrl Panel/ Programs/Program&Features)

3. Create a virtual machine profile, with a network legacy adapter, connected to a bridged type virtual switch, with type external network, which goes on the laptop ethernet adapter (cable)

4. From the ISO image mounted as optical drive, perform the guest OS setup (key combination for unlocking mouse from within the VM window is CTRL-ALT-LEFTARROW)

5. after installation and reboot, from the virtual machine window action menu, perform integration service setup (this brings in drivers for the more advanced non-legacy network interface support)

6. perform service pack and patching installations, downloading whatever is needed from within the VM

7. shutdown vm, switch to wifi connectivity and detach wired ethernet from the laptop

8. from hyperv manager, create another virtual switch, type INTERNAL. I called mine "WIFIvSwitch". Since this is internal type, it must not be bound to any physical interface

9. create a new network adapter in the virtual machine, and associate it with the newly created vSwitch

10. from host windows control panel, go to Network and Internet, Network connections. You will see a new vEthernet (wifivswitch) adapter, on unidentified network, with no internet access, with Public Network category. Double click on it, and make sure that you have the following checks: Client for MS networks, File and print sharing for MS networks, internet protocol version 4. No sharing settings, and no specific selection in home networking connection. Confirm.

11. now double click your wifi connection (should be green and active) that should have Internet access. Choose properties, then click sharing tab and check "allow other network users to connect thru this computer's internet connection", selecting the vEthernet (wifiswitch) in Home Ethernet connection. (sometimes this selection is not available. In my case it was showing up after a reboot). Let the default check on "Allow other network users to control or disable the shared Internet connection". Confirm

12. now turn on the virtual machine, and it should detect the new adapter, install and activate the drivers, request and get an IP address on a private autoselected range (i get 192.168.137.40/24, with gateway on .1), and then you should be able to have internet access thru the host wifi link.


Happy Networking!


@mgua

.



1 comment:

adie wei said...

Nice...Can i get a video tutorial for that