0

Little bit Background (Why I want to do this)

My Local Cable Operator (LCO) provides last mile infrastructure for 2 different ISPs. Let's say, ISP-1 and ISP-2. Customers can pay for any preferred ISP and use that ISP (physical fiber line is the same from the LCO switch to customer home for both ISPs. Users don't need to change physical connection if they change ISP). I have paid for both ISP and got connection details from both of the ISPs. I can specify any ISP IP/subnet on my Ethernet interface and my data will go through that ISP. Now, I don't have the LCO's original topology but here is a possible simplified one:

Simplified network topology

Now, My computer (OS-Windows) has only one ethernet NIC but I want to use both of the ISPs and I want to implement automatic failover in case one ISP is down. The basic procedure I thought is:

  1. I could assign both IP/subnet to my single ethernet interface and I could specify static routes. This works but it is not an elegant solution for detecting which ISP is up/down.

  2. If I had two different network interfaces (one physical and one virtual), I could use ping -S <interfaceIP> 8.8.8.8 for both ISPs and detect UP/DOWN status.

This is why I need to create a virtual interface on the physical NIC.

What I have done so far

  1. I tried to use TAP virtual adapter as suggested here but it is showing 'Network Cable Unplugged'. I tried to bridge it to the physical interface but it didn't work. I could specify only one IP to the bridge and both IPs of the interfaces (physical and virtual) disappeared.

  2. I followed this answer and tried to use Hyper-V external virtual switch. I entered the 2nd ISP IP/subnet on the virtual switch->Properties->IPV4. And entered the 1st ISP IP/subnet on the physical main ethernet interface (I had to enable IPV4 on this interface though because the virtual switch disabled them. Don't know why). Now, it works like a charm.

Final status

What I need help with

I am a little bit confused because I have never used Hyper-V virtual switch before.

  1. Why does a switch have an IP address? The switch is an L2 device and it is called the virtual switch.

  2. Why does the virtual switch disable the IPV4, client for Microsoft networks etc. on the original physical interface after creating it? I manually re-enabled them again from properties and this setup worked too without creating a 2nd virtual interface.

  3. On the above mentioned answer (from where I got the solution), the person commented: "you can create two virtual interface under that same virtual switch". How can I do that?

  4. Is there any way to make the virtual TAP adapter use the same physical ethernet NIC?

  5. Is there any easier way to achieve what I am trying to do?

Currently, the accepted answer explains the question 1 and 3. Any help with my other queries is welcome.

1

Basic overview:

  • Enable Hyper-V feature.
  • Add a Hyper-V virtual switch which automatically adds a virtual network interface (vNIC) in the management OS aka. the host OS.
  • Add another vNIC in management OS for our need.
  • Configure IP addresses in both vNIC. DO NOT add/configure IP address in the real network interface. More on this later.

Network Configuration:

Here are the details of network adapter for example. The interface names will vary in other systems.

  • Ethernet0: The default network interface.
  • vEthernet (Default Switch): Hyper-V installs this by default. Ignore this for current Q&A.
  • S1: Virtual network switch name.
  • vEthernet (S1): First vNIC connected to virtual switch S1.
  • vEthernet (S1) 2: Second vNIC connected to virtual switch S1, created from command line.

Procedure:

  • Enable Hyper-V feature with Powershell as administrator (or with OptionalFeatures.exe) with this command Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All and reboot the system.

  • To add a Hyper-V virtual network switch, open Hyper-V Manager from start menu or with run dialog box, type virtmgmt.msc. Go to Virtual Switch Manager > New Virtual Network Switch > Select External type > Create Virtual Switch > OK.

  • It is important to select External type for that virtual network switch. See this article for further details. The external switch type must be connected to a physical adapter. It allows communications between the physical network and the management operating system and the vNIC on virtual machines.

External_Type_Virtual_Switch

  • Enable "Allow management operating system to share this network adapter" option. This allows the Hyper-V host/management OS to share the use of the virtual switch.

Allow_Management_OS

  • Press OK to create that virtual switch. In Network Control Panel (ncpa.cpl), there will be vEthernet (S1) virtual network interface connected to S1 virtual switch. The Hyper-V Manager does not allow to create another vNIC. To create another one, run this command (Add-VMNetworkAdapter) in Powershell as administrator Add-VMNetworkAdapter -Switch S1 -ManagementOS. vEthernet (S1) 2 will be created. See this screenshot:

List_Of_Network_Interfaces

  • Configure vEthernet (S1) and vEthernet (S1) 2 with your two different ISP provided IP addresses. DO NOT add/configure/enable any IPv4 or IPv6 settings in the real NIC. See this screenshot. ONLY "Hyper-V Extensible Virtual Switch" component is enabled for Ethernet0.

Real_NIC_Configurations

The network topology is as follows:

    Physical Network Interface
            |
            |
    Hyper-V Virtual Switch (S1)
            |
            |
+-----------+------------------+------------------- other vNIC in VM
|                              |
vEthernet (S1)                 vEthernet (S1) 2
(172.22.36.151/25)             (172.30.138.151/24)
Host OS                        Host OS
  • Just to make sure, I understood you correctly, The interface we see on ncpa.cpl is a virtual interface connected to the virtual switch. So, it can have an IP address. This answers my question 1. -----But do you have any reason why I shouldn't specify the IP address to the real NIC? I added an IP (ISP 1) on the real NIC and another on (ISP 2) the vNIC and it works perfectly. This can also save me the hassle to add another one from PowerShell. – Sourav Ghosh Jan 22 at 7:39
  • @SouravGhosh Take a cup of coffee and read this blogs.technet.microsoft.com/jhoward/2008/06/16/…. Don't skip any line. – Biswapriyo Jan 22 at 7:56
  • The command you mentioned for adding the 2nd adapter, threw some error in my case. I used Add-VMNetworkAdapter -ManagementOS -Name ISP2 and it worked. – Sourav Ghosh Jan 24 at 20:01
  • I renamed the virtual switch name to S1. You should use the -Switch option with that command with your own vritual switch name otherwise that vNIC will not be connected to that virtual switch. – Biswapriyo Jan 24 at 20:07
  • Thanks for the article link. But still, I am not sure why I can't enable IPV4 protocol and specify an IPV4 address on the physical NIC. I re-enabled all protocols (they were disabled after enabling the v-switch) and kept the HyperV extensible virtual switch option enabled and it just worked. Maybe it can create some problem in VM networking but in my case, from the host OS, it didn't make any noticeable difference. Even on the technet article picture, the physical NIC and the vNIC both interfaces are connected to the virtual switch. So, specifying an IP on that interface should work. – Sourav Ghosh Jan 24 at 20:09

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.