VLANs in Hyper-V nested virtualization possible?

Gloria Gu 3,896 Reputation points
2020-07-16T08:03:43.267+00:00

Hello,

I have a little test environment using nested virtualization in Windows Server 2019 wehre I need to use VLANs.
The environment consists of:

  • pHost > a physical server with Hyper-V role
  • vHostSwitch > a private virtual switch on pHost
  • vHost1 > a virtual server on pHost with Hyper-V role, connected to vHostSwitch (mac spoofing & ExposeVirtualizationExtensions enabled)
  • vmSwitch > an external virtual switch on vHost1 (shared with management os)
  • vHost2 > a virtual server on pHost with Hyper-V role, connected to vHostSwitch (mac spoofing & ExposeVirtualizationExtensions enabled)
  • vmSwitch > an external virtual switch on vHost2 (shared with management os)
  • VM1A > a virtual Server on vHost1, connected to vmSwitch (on vHost1)
  • VM1B > a virtual Server on vHost1, connected to vmSwitch (on vHost1)
  • VM2A > a virtual Server on vHost2, connected to vmSwitch (on vHost2)
  • VM2B > a virtual Server on vHost2, connected to vmSwitch (on vHost2)

So far, so good. All Servers can ping and reach each other without VLANs.

Also everthing is fine, when I configure a VLAN on the pHost by Setting the same VLAN ID in the Hyper-V network Cards for vHost1 and vHost2.
vHost1, vHost2, VM1A, VM1B, VM2A, VM2B can still ping each other, and as expected can't ping VMs with different or no VLANs connected to vHostSwitch.

But what I need is setting up a VLAN for VM1A and VM2A, and a separate one for VM1B and VM2B.

As soon as i set VLANs in the Hyper-V network cards for those 4 VMs, the VMs on vHost1 cannot cummincate with VMs on vHost2 in the same VLAN.
This doesn't change wether or not I'm using VLANS on the pHost for the vHosts.
VMs in the same VLAN within one vHost can communicate without a problem.

Also Setting a VLAN for the Management OS in vmSwitch on vHost1 and vmSwitch on vHost2 stops the vHosts from communicating with each other.

In a real Environment, vHost1 and vHost2 would be physical servers connected to a physical VLAN capable switch.
But in nested virtualization the vHostSwitch needs to play the role of the physical VLAN aware switch.
While Hyper-V switches definitely can handle VLANs, it seems they drop VLAN tagged packets comming from Hyper-V switches from within the nested virtualization.

So is there any way to make VLANs work between VMs between different nested Hyper-V hosts on the same physical Hyper-V host?

thanks in advance!

Thread source link: https://social.technet.microsoft.com/Forums/windowsserver/en-US/f88c3245-5c15-405e-b7e9-00d6276f8459/vlans-in-hyperv-nested-virtualization-possible?forum=winserverhyperv

Hyper-V
Hyper-V
A Windows technology providing a hypervisor-based virtualization solution enabling customers to consolidate workloads onto a single server.
2,613 questions
0 comments No comments
{count} votes

Accepted answer
  1. Xiaowei He 9,876 Reputation points
    2020-07-16T08:14:16.25+00:00

    Hi ,

    Thanks for your post!

    Based on my understanding, you would like to use VLAN ids for the nested hyper V VMs.

    Yes, as you mentioned, if we want to use van id for VM1A, VM1B, VM2A and VM2B, we need to set the virtual network adapter in vhost1 and vhost2 in trunk mode:

    Below are some articles in detail for reference:

    https://video2.skills-academy.com/en-us/windows-server/virtualization/hyper-v/deploy/configure-virtual-local-areal-networks-for-hyper-v

    https://social.technet.microsoft.com/wiki/contents/articles/1306.hyper-v-configure-vlans-and-vlan-tagging.aspx

    Thanks for your share!

    Best Regards,

    0 comments No comments

0 additional answers

Sort by: Most helpful