230

I've got Windows 8 Pro on my home machine. I want to have a Windows 7 Professional VM running under Hyper-V, and I want the VM to have full internet access. My physical machine has a wireless network adapter I use to connect to a router.

Here's what I've done so far:

  • In Hyper-V Manager, I've created a new External Virtual Switch, which is connected to my wireless network adapter. If I look in Windows 8's Network Connections page, I can see it's created a virtual ethernet adapter and a network bridge, and my wireless adapter is now bridged.

  • I've created a Windows 7 VM, and in the Hyper-V settings I've set it to use the virtual switch.

When I log into the VM, I have a network, but it's "unidentified" and has no internet access. What am I missing? Is it something to do with the "VLAN identification" settings? I'm not quite sure what these are about.


This question was a Super User Question of the Week.
Read the blog entry for more details or contribute to the blog yourself

Graham Clark
  • 2,381

6 Answers6

285

In order to get the VM connected to the internet you have to tie it to the Ethernet/Wireless NIC Card. In order to do this you have to create a "Virtual Switch".

  1. Open your Hyper-V Manager
  2. Select Action --> Virtual Switch Manager

    Accessing the VM Switch Manager

  3. Select External and then Create Virtual Switch

    Virtual Switch Manager

  4. Give the Switch a Name and then select the External Controller you use to connect to the internet (Ethernet, or Wireless NIC, etc,.)

    Note: You must select the way that you are actually connecting to the internet. IE, if your computer is set up to use Wifi or Ethernet, but is currently using Ethernet, you must use Ethernet - the Wifi connection will not work because the host machine isn't currently using it.

    VM Switch Properties

  5. Select Apply and then OK

  6. Right click on the Virtual Machine you want to connect and select Settings

    VM Settings

  7. Under the Network Adapter Setting select the newly created Virtual Switch

Connecting the Switch to the VM

This should enable the connection you use to connect to the internet to be accessible to the VM


Note: you may have to do a ipconfig /release and ipconfig /renew (Windows) or a sudo dhclient -v -r and sudo dhclient -v (Linux) on the remote machine to get it to renew its DHCP settings and retrieve an IP address.

James Mertz
  • 26,529
23

I had to disable and then re-enable the Allow management operating system to share this network adapter under the Virtual Switch Manager.

If this isn't checked the host machine will not be able to use the chosen adapter. It had been checked in my case, for some reason I had to flip it back and forth again.

Canadian Luke
  • 24,640
R Horne
  • 331
7

Without rebooting I managed to get it working with a wireless adapter, which otherwise was doing nothing.

Open the network connections control panel

You'll see the virtual adapter setting has created a network bridge.

enter image description here

Right click on your Wi-Fi adapter (the one with the signal strength icon) and select Connect/Disconnect

Then you have to click the On switch that comes up in the sidebar and select your network. For some reason it was Off even though I was online before.

enter image description here

Everything then magically lit up and I was able to access the internet from within my Win XP VM immediately.

enter image description here

Simon
  • 672
6

Recent Hyper-V versions have a virtual adapter called "Default Switch", that is preferable to be used by the VM. It does a complex internal routing to allow machines to work. Just connect your VM's to it and it should work.

Alternatively to connect the VM to the Internet via a WiFi network you can use an "Internal" Virtual Switch. On the screenshot I use Ethernet, but it works with WiFi too. Internal switches do not expose your VM to the Internet, so they is the best solution in general.

Basically you need to create an Internal virtual switch and connect your VM's adapters to it, then use the OS's Share internet connection feature.

All steps in screenshots:

Create internal switch

Then from Adapters in Control panel share your Internet connection (any adapter works).

Share Internet connection

Sometimes (usually after Windows update) the VM loses the connection although everything seems properly setup. In such case you need to turn off the Internet sharing and then enable it again. You don't need to restart.

venimus
  • 2,488
6

Another trick as detailed in this question Windows 8 Hyper-V network not working on host is that this may not work over wireless... re did the setting several times nothing - set up an ethernet adapter - worked straight away. [quick edit to say of course I'd set up separate virtual switches for the two physical adapters...]

5

In my case, while the VM was running I changed the virtual Switch settings to “Not Connected” and then back to my newly created virtual switch. Worked.

random
  • 15,201