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

1
  • @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, 2016 at 13:20

6 Answers 6

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.

17
  • 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. Sep 12, 2012 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. Sep 13, 2012 at 19:37
  • 7
    Anyone looking for the "Switch Manager" it's no longer under Action - instead right click the computer name (in the left area) Jan 15, 2014 at 9: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 9, 2015 at 1:48
  • 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, 2015 at 15:27
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.

3
  • I had to disconnect & connect my wireless connection after disable & enable step. Apr 25, 2014 at 5: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, 2014 at 20:05
  • @PiotrKula In that case you do a: Get-VMSwitch and then a Set-VMSwitch -Name <swtch-name> -AllowManagementOS $True on a powershell console. Just for future reference! ;)
    – NoOne
    Jan 25, 2020 at 9: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

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...]

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.

3
  • This is the only solution that worked for me! I spend hours trying to installing and uninstalling Hyper-V and Docker. Thank you! May 24, 2018 at 10:09
  • This completely killed the connection to the hyper-v server, thanks.
    – one-liner
    Oct 14, 2019 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, 2019 at 12:09
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.

1
  • 1
    "Hullo, IT! Have you tried plugging it off & on again?" Oct 11, 2016 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .