Sunday, August 31, 2014

Vlans into Hyper-V VM Machines

A couple months I posted about running CentOS under hyper-v and some challenges related to the integration kit (or so I thought).

I recently came across what I was really looking for.

If I want the Linux (Or whatever) VM to have multiple vlans to a single nic into the vm, the solution is not in the GUI. Big shock there. You will find the following powershell command very useful.


This command along with it's Get counterpart is very useful yet obscure. This command is like setting the port on the switch to pass the vlans that you want, only this is the virtual hyper-v switch.

Here is the link to the TechNet article explaining it:

From the article here is an example:

PS C:\> Set-VMNetworkAdapterVlan -VMName Redmond -Trunk -AllowedVlanIdList 1-100 -NativeVlanId 10

There is the keyword -Trunk. which makes the magic happen. Now if only MS would make reference to the status of the virtual switch port to the vm in GUI this might not have been such an wayward adventure. I believe that VMWare at least show the vlans in the gui. 

Hopefully this little bit of info will help others with this simple but confusing piece of MS setup.

No comments:

Post a Comment