Win10 Accesses the Internet With Hyper-V's Virtual Switch


  1. Posts : 62
    Windows 10
       #1

    Win10 Accesses the Internet With Hyper-V's Virtual Switch


    After adding Hyper-V to Windows 10 Pro, Windows now accesses the internet with the virtual switch I created for Hyper-V instead of my Ethernet connection. Why isn't Windows 10 using my Ethernet connection?
      My Computer


  2. Posts : 17,640
    Windows 10 Pro
       #2

    Your host machine is still using the Ethernet connection, it's just used through an external virtual switch. That's how it should be.

    To allow communications between virtual machines and host, between different virtual machines, and to let both host and virtual machines access Internet, host machine needs to use the same external switch than virtual machines.

    Let it be as it is, there's no issue here things being as they should be.

    Kari
      My Computer


  3. Posts : 62
    Windows 10
    Thread Starter
       #3

    Thanks very much for your help. Please bear with me as I become better acquainted with Hyper-V:

    I expected to see the virtual switch being used for internet access by the virtual machine when I am actually running the virtual machine. I was not expecting to see the virtual switch being used for internet access by my computer when I am not running a virtual machine. In that case I was expecting to see my computer using my 'regular' Ethernet connection, just as it did before I added Hyper-V.

    It seems there's something basic about Hyper-V that I don't understand (yet.) Would you please explain?
      My Computer


  4. Posts : 3,257
    Windows 10 Pro
       #4

    Bulldog said:
    Thanks very much for your help. Please bear with me as I become better acquainted with Hyper-V:

    I expected to see the virtual switch being used for internet access by the virtual machine when I am actually running the virtual machine. I was not expecting to see the virtual switch being used for internet access by my computer when I am not running a virtual machine. In that case I was expecting to see my computer using my 'regular' Ethernet connection, just as it did before I added Hyper-V.

    It seems there's something basic about Hyper-V that I don't understand (yet.) Would you please explain?
    It's really pretty simple. Imagine if you had 3 physical computers, and one cable modem (with a single port on it). Now, in order for these three computers to talk to each other, and all talk to the internet, you would need a switch that sits between the modem and the computers. Correct?

    That's basically what is happening here. Only one computer (either virtual or physical) can use the built-in Ethernet connection, so when you install Hyper-V it creates a "virtual switch" that sits between the host computer, as well as all the virtual computers so they can all talk to each other, as well as the internet. Just like in the previous scenario.

    If the host was talking directly to the Ethernet, then the guests would not be able to use it.
      My Computer


  5. Posts : 62
    Windows 10
    Thread Starter
       #5

    Aha! Now I get it.
      My Computer


  6. Posts : 13,670
    Windows10
       #6

    Mystere said:
    It's really pretty simple. Imagine if you had 3 physical computers, and one cable modem (with a single port on it). Now, in order for these three computers to talk to each other, and all talk to the internet, you would need a switch that sits between the modem and the computers. Correct?

    That's basically what is happening here. Only one computer (either virtual or physical) can use the built-in Ethernet connection, so when you install Hyper-V it creates a "virtual switch" that sits between the host computer, as well as all the virtual computers so they can all talk to each other, as well as the internet. Just like in the previous scenario.

    If the host was talking directly to the Ethernet, then the guests would not be able to use it.
    Good description. I learnt something!

    I assume VMware etc do something similar but less obvious?
      My Computer


  7. Posts : 3,257
    Windows 10 Pro
       #7

    cereberus said:
    Good description. I learnt something!

    I assume VMware etc do something similar but less obvious?
    I haven't used VMWare in ages, but I think VMWare installs some kind of middleware driver in the network stack to do this.
      My Computer


  8. Posts : 11,203
    Windows / Linux : Arch Linux
       #8

    Mystere said:
    I haven't used VMWare in ages, but I think VMWare installs some kind of middleware driver in the network stack to do this.
    Hi there

    Vmware creates a "Virtual" adapter which as you say essentially does the same thing. These are vmnet0-vmnetn depending on how you connect to the physical NIC. Vmware routes the traffic via the vmnet interface to the physical nic on the host and hence to router and internet / LAN.

    I'm not sure how this works or can be set up if you have 2 or more physical nics on the machine

    Here's 4 VM's running on a Linux Host -- 3X W10 and 1 X W7 - network map as seen from the W7 machine. Host is machine BROWNBEAR running Linux CENTOs 7.

    I've had up to 8 running concurrently -- response drops off a bit then and if you are only using 1 physical nic you want at least a 1 - 10Gib/s one. I've actually 2 physical NIC's on the Host but not sure how to use the second one in a VMWARE network I know it's easy with HYPER-V though - but then I can't have LINUX as the host.

    Win10 Accesses the Internet With Hyper-V's Virtual Switch-nw10.png

    Cheers
    jimbo
      My Computer


  9. Posts : 17,640
    Windows 10 Pro
       #9

    Just to add to Mystere's excellent post, using a Hyper-V external switch virtual machines get a bridged connection. If you prefer NAT (Network Address Translation) instead, you don't have to create an external virtual switch. About bridged vs. NAT: NAT vs. bridged network: A simple diagram - TechGenix

    To use NAT in Hyper-V, first create an Internal switch in Virtual Switch Manager then share your host Ethernet or WLAN connection with your internal switch:

    Win10 Accesses the Internet With Hyper-V's Virtual Switch-image.png

    In VM settings set virtual machines to use the internal switch. They will now get private IP addresses 192.168.137.XXX, internal switch on host acting as DHCP server with IP 192.168.137.1.

    Using NAT only with virtual machines makes external virtual switch unnecessary but as it makes networking between host and virtual machines quite a challenge if not impossible, the bridged mode with an external switch is the recommended way.

    Quote from an old tutorial at our sister site EightForums.com:

    Part 1: Understanding Virtual Switches

    To connect a virtual machine (hereafter vm) to network it needs a network controller (hereafter NIC) the same way as any physical computer would need. In Hyper-V virtualization this NIC is of course virtual, it does not exists physically.

    As we cannot connect a virtual NIC to a physical router we need a Virtual Switch (hereafter VS) to act like a network bridge between host NIC and vm virtual NIC. See the image below:

    Win10 Accesses the Internet With Hyper-V's Virtual Switch-virtual_switch_12.png

    A Virtual Switch can be external, internal or private.
    • External Virtual Switch: will connect a vm to host NIC. If host NIC is connected to Internet through router, the vm is also connected to Internet. If host NIC (LAN) is not connected to router or if the router has no Internet access, the internal network will still work allowing computers (physical and vm) belonging to the same subnet and workgroup or domain to communicate with each other (file and media sharing etc.). When connecting external switch to host WLAN NIC, the vm loses all connectivity when WLAN is disabled or not connected on host.
    • Internal Virtual Switch: When a virtual NIC is connected to Internal VS it can communicate with other computers and vms on the same subnet but has no Internet access if host Ethernet or WLAN connection is not shared with it.
    • Private Virtual Switch: When a virtual NIC is connected to Private VS it can communicate with other vms on same Hyper-V server but cannot communicate with host PC nor has it Internet access. A Private vs is often needed when installing a legacy Linux or pre-XP Windows vm. After installation you need then to disable Private Switch and use Internal or External to connect to the network.
    (From EightForums.com tutorial Hyper-V Virtual Switch Manager)

    Kari
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:08.
Find Us




Windows 10 Forums