Hyper-V vlan tagging

hyper-vvlan

I'm trying to get a VM running in Windows 8.1 on a different VLAN than what the O/S is using. I'm using an Intel NIC and have installed the Intel drivers, which have VLAN tagged on by default. It's connected to a HP switch that is configured with one VLAN untagged and another VLAN tagged (in Cisco-speak, it's a trunk port with two allow VLANs, one of which is the native VLAN). I would like the VM to be able to use the tagged VLAN for communication, while the Windows 8.1 host uses the untagged VLAN.

To this end, I've configured a virtual switch, attached it to the physical NIC, and told it to allow management O/S on the NIC with no VLAN ID. Then in the VM, I connected the Network Adapter to the virtual switch, and told it to use VLAN 4.

Two questions:

  1. Is this the correct way to set this up?
  2. Should the VM be sending out packets tagged or untagged? i.e., do I need to set up VLAN tagging in the O/S?

Ideally, what I'd like is something like this:

physical /____ VLAN 1 untagged ____\ virtual /____ VLAN 2 untagged ____\ VM
 switch  \      VLAN 2 tagged      / switch  \                         /

Update:

This link seems to indicate that packets go through the virtual switch with tagging intact, so packets without the VLAN tag will go to VMs with no VLAN set, otherwise tagged VLAN packets go through to the VMs for that VLAN, so VLAN tagging needs to be configured in the VM.

Can anyone confirm or deny this? I'm going to try to add VLAN support to my VM when I get a chance, but it seems… wrong somehow. Maybe I'm just used to how VMware did it with port groups, where VLAN tagged wasn't required in the guest…

Best Answer

This is the right way to do it. You bind your NIC to a Hyper-V Virtual Switch, and then in the hardware config for the VM you set the VLAN to use. You don't want or need VLAN tagging enabled inside the guest VM.