229

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
  • 3
  • 18
  • 18
  • @Kronos - How & where in Windows 8.1 can one assign a Static IP to the Host Machine (with an External Virtual Switch)? It was easy to do so with the HV VM, but the static IP on the Physical Host Adapter seems to be gone and cant use it to access Host via RDP anymore. Direction please? – Alex S Nov 29 '16 at 13:20

6 Answers6

284

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,224
  • 41
  • 111
  • 163
  • 11
    This is a great description, but it's exactly what I did. I did manage to get it all working though, I'll check at home this evening and either add an answer or mark someone as correct. – Graham Clark Sep 12 '12 at 10:44
  • 5
    Not exactly sure how I got it working, I think I'd ticked the "Enable virtual LAN identification" box and then unticked it whilst the VM was running - for some settings like this, the VM needs to be off/restarted to take effect. – Graham Clark Sep 13 '12 at 19:37
  • i had to uninstall virtualpc2007 otherwise my physical network stopped working after step4/5 – wal Feb 07 '13 at 23:17
  • works flawlessly!!! so nice of you for great answer. – TheVillageIdiot Oct 09 '13 at 05:46
  • This procedure installed a network bridge under "Control Panel\Network and Internet\Network Connections". Every time I boot the VM I have to disable then enable the bridge (via its right-click menu). I've read similar accounts from others. Hope they get it ironed out. – Vimes Jan 09 '14 at 02:37
  • 7
    Anyone looking for the "Switch Manager" it's no longer under `Action` - instead right click the computer name (in the left area) – Benjamin Gruenbaum Jan 15 '14 at 09:11
  • 2
    I've done this before and lost internet access. Googled, came here, removed everything and followed these instructions. Lost internet access again because the creation of the switch didn't take over my DNS servers. I had to ncpa.cpl -> WLANswitch properties and manually add them again in IPv4 settings (W8.1 Enterprise x64) – Jakke Jan 09 '15 at 01:48
  • I couldn't add a new virtual switch to the desired network adapter since I was already bound to a virtual switch and for some reason it doesn't allow more than one binding. It shouldn't be a problem though since te existing binding/virtual switch is already of the type External. The Windows 7 VM still isn't able to access the Internet with it though - but it does recognize the switch. – Bent Rasmussen May 14 '15 at 14:37
  • I just solved the problem for my part by adding a legacy network adapter to the virtual machine (older network card) - for some reason that made a difference. That is dispite the fact that Hyper-V integration services were already running on the VM, so it shouldn't have been necessary! Well, it was solvable, but kind of a crappy experience. – Bent Rasmussen May 14 '15 at 15:02
  • best description ever :) – juFo May 17 '15 at 10:08
  • 1
    I tried this on both Wired and wireless connections but get limited connectivity. It's not getting an IP address. DHCP, doesn't seem to be working. If I set manually the IP, DNS, and default gateway on the client, it works. – Rick May 21 '15 at 15:27
  • 1
    One of the best, thoughtful, step-by-step posts I've seen. Thanks for taking the time and effort to put this answer together! – code4life Aug 02 '15 at 17:17
  • After adding the virtual network network switch in the Virtual Switch Manager I had to close the Virtual Machine Connection window and the Hyper-V manager window and reopen them. After that I was able to associate the new switch with the VM. – Martin Eden May 12 '16 at 12:25
  • Creating the new switch worked for me. I was trying to use existing switches and for some reason it was not working. – Aster Veigas Feb 27 '17 at 07:25
  • excellent, excellent post with clear pictures... I'd stupidly plugged in my network card and forgot to change the source on my switch! running through this I realized, and now have 2 switches that I can _switch_ between (pardon the pun) - I've upvoted this, if I could upvote more I would and also send cake – Pete Jul 10 '17 at 11:23
  • THANK YOU for the sudo dhclient bit! I've been tinkering around with my settings for a full day because the external switch just plain wouldn't work, but running those commands from the guest OS fixed it! :) – Deep-B Sep 05 '17 at 08:36
  • The last commands helped me out. – Devid May 23 '18 at 18:35
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,199
  • 39
  • 117
  • 171
R Horne
  • 331
  • 1
  • 2
  • I had to disconnect & connect my wireless connection after disable & enable step. – Joy George Kunjikkuru Apr 25 '14 at 05:56
  • 17
    WARNING - Doing this on a remote server will completely kill the connection as soon as you untick this. I found out the hard way :( – Piotr Kula Sep 23 '14 at 20:05
  • @PiotrKula In that case you do a: `Get-VMSwitch` and then a `Set-VMSwitch -Name -AllowManagementOS $True` on a powershell console. Just for future reference! ;) – NoOne Jan 25 '20 at 09:34
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
  • 662
  • 7
  • 21
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
  • 1,898
  • 2
  • 15
  • 11
  • This is the only solution that worked for me! I spend hours trying to installing and uninstalling Hyper-V and Docker. Thank you! – Michael Chudinov May 24 '18 at 10:09
  • This completely killed the connection to the hyper-v server, thanks. – one-liner Oct 14 '19 at 10:08
  • > 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. Did you try that? – venimus Oct 14 '19 at 12:09
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...]

Mike Walsh
  • 153
  • 3
  • 7
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
  • 14,638
  • 9
  • 54
  • 58
user215043
  • 51
  • 1
  • 1