Windows 8 Hyper-V & VLANs

hyper-vtrunkvlanwindows 8

I'm trying to setup Windows 8's Hyper-V so that I have:

  • Switch which has 2 VMS connected to it
  • Vyatta box which is connected to said switch and set as trunk (native vlan 1, allowed vlans 1-4000)
  • Windows 2008 R2 server with access vlan 2002

I have created said VMs and both are conncted to same switch. I have used following commands from PowerShell to set Vyatta's network interface to trunk mode:

$z = (Get-VMNetworkAdapter -VMName vyatta)[1]
Set-VMNetworkAdapterVlan -VMNetworkAdapter $z -Trunk -NativeVlanId 1 -AllowedVlanIdList 1-4000
Get-VMNetworkAdapterVlan
VMName                       VMNetworkAdapterName Mode     VlanList
------                       -------------------- ----     --------
                             swname               Untagged
windowsvm                    Network Adapter      Access   2002
vyatta                       Network Adapter      Trunk    1,1-4000

As far as I understand VLANs and Hyper-V, this should be everything I need to do. However, it seems like strips the tag and replaces it with native VLAN's tag.

When doing capture on said interface on Vyatta (tcpdump -s0 -XX -nnpi eth0), the ARP packet which arrives from Windows machine looks like following:

11:26:50.908865 ARP, Request who-has 10.16.32.1 tell 10.16.32.2, length 28
        0x0000:  ffff ffff ffff 0015 5d01 dc03 0806 0001  ........].......
        0x0010:  0800 0604 0001 0015 5d01 dc03 0a10 2002  ........].......
        0x0020:  0000 0000 0000 0a10 2001                 ..........

Note 0x000C-x000F that shows 0001 (VLAN ID = 1) instead of 07d2 (VLAN ID = 2002).

I also noticed that if I change AllowedVlanIdList so that it doesn't include 2002, I will no longer see the ARP request.

Anyone know how I could force Hyper-V to keep the tag or is this a limitation on W8 Hyper-V?

Best Answer

I'm not sure if Windows Server 2008 R2 supports the network set up you've used there, neither in Virtual Machine Manager 2008 R2 nor in Hyper-V Manager on 2008 R2 do I see how to set VLAN trunking on a per-virtual machine level. In my set up, per Virtual Machine Manager 2008 R2's network configuration, I see this:

Virtual Machine Manager 2008 R2 host properties window, showing the Networking tab with the LAN adapter selected and the VLAN set to Trunk mode.

On the switch, I have VLAN 1 set as the primary (untagged) and everything else tagged and the switch ports for the server set to trunk. I then set up my Vyatta box so that it has a single NIC per VLAN I wanted to access, I was never able to set up a trunk on the VLAN and the management for the VM seem to indicate that it's not possible in 2008 R2, and I'm not sure if it's actually implemented for it.

I do know that the Set-VMNetworkAdapterVlan PowerShell cmdlet was added in the WMF 3.0 management pack, which is advised not to be installed on 2008 R2 currently because it was released with serious issues. (WMF 4.0 is slated to be released soon and resolve those problems, I believe.) It might be possible that the cmdlet you're using to set the Vyatta VM's network adapter to trunked mode isn't fully implemented on 2008 R2. I've never seen a VM configured in trunked mode myself.

Alas, I do not have a 2012 setup with Vyatta and Wireshark to test your setup.