Windows 8 and 8.1 Forums


Weird Hyper-V virtual switch behavior

  1. #1


    Posts : 12
    Win8 64bit

    Weird Hyper-V virtual switch behavior


    I have a Win8-64 system hosting a Win8-32 VM. A physical Wifi adapter provides Internet sharing, and a virtual switch provides Internet access to the guest VM via "internal network".

    However, the Win8-64 host seems to be confused as to which adapter provides Internet access. If I delete the virtual switch, the Wifi adapter works fine. If I create a virtual switch, the system works initially fine with both host and guest accessing the internet. However, on wake-from-sleep the host loses Internet access while the VM still retains access!

    My "layman diagnosis" is that the virtual switch bypasses somehow the host. I am getting rather desperate about this behavior, and I haven't been able to find any advice via Google. Can somebody enlighten me on how to instruct the host to always poll the physical adapter for Internet access?

    many thanks in advance!

      My System SpecsSystem Spec

  2. #2


    Posts : 12
    Win8 64bit


    I should mention that of course I could connect the VM through an "external network". But then I would have two different IP addresses for guest and host - which is OK in my home network, but horrible anywhere else. In a hotel, I would have to buy two access codes for guest and host! Hence, NAT is my only viable option.
      My System SpecsSystem Spec

  3. #3


    A Finnish ex-pat in Leipzig, Germany
    Posts : 1,452
    Windows 8.1 Pro with Media Center


    Quote Originally Posted by aag View Post
    I should mention that of course I could connect the VM through an "external network". But then I would have two different IP addresses for guest and host - which is OK in my home network, but horrible anywhere else. In a hotel, I would have to buy two access codes for guest and host! Hence, NAT is my only viable option.
    What an earth are you talking about?

    Of course you only have one public (external) IP also when using an external virtual switch. You have completely misunderstood this about virtual switches.

    Let me try to explain. A physical Network Interface Controller (NIC) or as it is often called Network Adapter connects your host PC, the physical computer to the network. It can be a LAN NIC or a WLAN NIC, most computers especially laptops today have both available.

    Your Hyper-V virtual machine (vm) has no physical hardware, it "borrows" what it needs from host. If you have not removed Network Adapter from vm settings in Hyper-V, it has one but as the machine is virtual all its hardware is virtual, too. Therefore we say your vm is using a virtual NIC.

    Of course you can not connect a virtual NIC physically to router or network. That's why you need a virtual switch; a virtual NIC connects itself to a virtual switch, which then connects further to host's physical NIC to allow networking:

    Click image for larger version

    If your PC has both LAN and WLAN, and if you have created an external virtual switch for both NICs you can use both NICs / switches to connect to internet at the same time. I do it all the time: my physical host computer is (when possible) connected with LAN NIC. I have created an external virtual switch which uses the WLAN NIC of the host, and normally my virtual machines use it.

    All your public (external) network traffic goes through router (or modem). It gets a public (external) IP from your service provider and then gives local (internal) IPs to each networked device on your network. The system sees no difference if these devices are physical or virtual, each is treated equally.

    You can test this easily to see that regardless how many real physical computers or virtual machines you have online at the same time, as long as they connect through same router they all have separate local (internal) IP addresses but all are using the one and same public (external) IP address. Screenshot below shows my computer a few minutes ago; I have a remote desktop connection to my Windows 7 Hyper-V vm which is using an external virtual switch connected to the WLAN NIC on my host, and my host computer is connected with LAN NIC:

    Click image for larger version
    (I only blurred a few digits for not to reveal my public IP but you can still see they are the same.)

    Theoretically it could be possible to get different public IPs for both LAN NIC and WLAN NIC. It would be possible if both physical NICs on your host would connect to different routers (modems). To do this you would need to do some tweaking, it does not happen by itself. However, using your hotel example, I have traveled a lot and yet I have never seen a hotel where even if you could connect both LAN and WLAN at the same time you would have to pay for two connections. Most hotels only have either LAN or WLAN available and in hotels with both connection types available at rooms they normally belong to the same subnet. You get the access code, give it to PC and that's it. No difference if you connect with LAN or WLAN.

    This theoretical possibility totally vanishes if you only use one NIC. If you at a hotel connect wireless using WLAN NIC, and your vm connects to an external switch which uses the same WLAN NIC, all your network traffic from both host and guest are going through the same NIC with just one public IP. The same if you have 10 virtual machines running and online, all of them share the public IP with your host or rather with your router.

    Kari
      My System SpecsSystem Spec

  4. #4


    Posts : 12
    Win8 64bit


    Kari, thank you for taking the time to compile an exhaustive response for my benefit! I guess I have expressed myself poorly - I (think that I) understand the concept of virtual NIC. And yet, with an external virtual switch I do end up with my router offering two LAN IP addresses via DHCP: one for the host and another one for the guest. Using an internal virtual switch the host provides an internal IP address through its own DHCP to the guest. Right? Sorry - I may be a bit thick this morning...
      My System SpecsSystem Spec

  5. #5


    A Finnish ex-pat in Leipzig, Germany
    Posts : 1,452
    Windows 8.1 Pro with Media Center


    Yes, two local / internal IPs.

    Check What Is My IP Address | Shows Your IP Address both from guest and host and tell me if the public / external IPs really are different? I do not believe it without a screenshot showing both at the same time!

    Kari

    EDIT:

    Check this tutorial, Part 2 Step 3: Hyper-V Virtual Switch Manager

    If you do not allow management system to share connection, then you need use separate NICs for vm and host. If this is the case and both NICs are connecting to the Internet using different public IPs (two routers), it is possible to get different public IPs.

    Local (internal) IP is of course always different.
      My System SpecsSystem Spec

  6. #6


    Posts : 12
    Win8 64bit


    I will do - but I do not have the laptop at hand right now here (University of Zurich). I should tell you one more complication:
    • After startup, the guest system must connect to a VPN.
    • As a result, I lose RDP connectivity from the host to the guest as soon as the VPN is on. (I can still log to the guest via HyperV terminal).

    I believe that I might circumvent these issues by creating two vNICs for the guest, one external and one internal. Do you have any thoughts on this?
      My System SpecsSystem Spec

  7. #7


    A Finnish ex-pat in Leipzig, Germany
    Posts : 1,452
    Windows 8.1 Pro with Media Center


    OK, jetzt verstehe ich!

    When you connect your guest to a VPN it is no longer part of your subnet but instead joins that of the VPN servers. Leaving your subnet and joining that of your Universität Zürich the connection between host and vm is naturally lost if the selection on virtual switch settings I mentioned in my previous post is not checked (I added the tutorial link later, you might not have seen it).

    All vm's traffic still goes through your host's NIC but when without VPN it was directly connected to the WAN, now all traffic goes through VPN and your VPN server gives you a public IP. In this case you naturally have two external IPs, the vm uses the same public IP than your host only to VPN and thereafter that of VPN.

    You have, as far as I can think of it, two possibilities to maintain WAN connection from your host when connected to VPN:

    1. Check the tutorial mentioned in my last post, Part 3 Step 2. If the selection is made the vm shares connection with host and both are connected to WAN even if the vm is connected to VPN. This is the method I recommend for it is so easy; just share virtual switch and as long as your host is connected to WAN, all virtual machines are too.

    2. Create two external virtual switches, one connected to WLAN NIC of your host, the other to LAN NIC. Connect your laptop with Ethernet cable, it should now use the external LAN switch for communications. Set vm to use the second external switch, the one connected to WLAN NIC. Connect vm to VPN, use host Internet normally even if the virtual switch vm is using is set not to share connection.

    An example of that second alternative above. On host, both LAN and WLAN are connected:

    Click image for larger version

    In Virtual Switch Manager I have created an external virtual switch which is connected to WLAN NIC. This switch is set not to share connection:

    Click image for larger version

    My Windows 7 vm is set to use the non-shared WLAN switch:

    Click image for larger version

    The vm is connected to a private VPN. Host and vm no longer share the public IP, both online with own IPs:

    Click image for larger version


    Something important for you to understand: In your case, as far as to the Universität Zürich VPN both switches are using the same public IP, that of your router. Your VPN only gets the second public IP after it is connected to VPN and uses it thereafter but the VPN server recognizes your connection as coming from the same public IP than your host is using.

    My point is still valid: As both switches are connected to NICs which use the same router for connection, you only have one real physical outbound connection from your laptop. This one outbound connection includes then the host and all virtual connections from vms running on it. If you were now at a hotel as you mentioned in your earlier post, you would still cope with one access code to hotel network. If simultaneous connections to LAN and WLAN at hotel were not possible, just select the #1 method mentioned above.

    Kari
      My System SpecsSystem Spec

Weird Hyper-V virtual switch behavior
Related Threads
Hyper-V Virtual Switch 101: How to create and use Virtual Switches to connect Virtual Machines to Network I will try to make this tutorial as simple and easy to understand as possible. Therefore some examples used might seem to you fellow geeks too simple. However, I ask you to understand that...
Hello all, I'm learning windows phone 8, and I want to run the windows phone 8 simulator on my PC ( OS windows 8.1 pro ), but the simulator can not run because it can not create the virtual switch in Hyper-V, and I also can not do it manually :mad:. This is the error when I create the new virtual...
I am running Windows 8.1 Pro with Hyper-V enabled. When I had Windows 8 I could install a Virtual switch with out any problems, since upgrading I can not install a Virtual Switch with External or Internal settings. Not sure if this is relevant or not but when I look at the Ethernet properties...
So my dad just purchased a brand new ASUS notebook model number K55N last week. He's been using it all these days without any issues, but just today he started seeing some weird behavior with it (mostly slowness) and a couple of errors, the most noticeable being when he boots up the laptop and...
hyper-v - error in creating external virtual switch I got an error in creating external virtual switch at hyper-v on windows 8 pro x64. I have one xp vm and tried to make an network connection, but I coul not success. Please let me know how to make creating external virtual switch at...
Weird PPPOE behavior in Windows 8 in Network & Sharing
I have been experiencing some weird problems with my PPPOE connection ever since I upgraded to Windows 8. 1. Windows will never autodial the connection. Regardless of settings. When I thick the checkbox in "Connect Automatically", and click connect, next time the dialog pops, it will be...
Hi All, Getting a strange error with Hyper-V on Windows 8 Pro x64. When I try and add a virtual switch I get: Error Applying Virtual Switch Properties Changes Failed while adding virtual Ethernet switch connections. Ethernet port '{a bunch of stuff}' bind failed: The data is invalid....
Eight Forums Android App Eight Forums IOS App Follow us on Facebook