сряда, януари 05, 2022

Hyper-V trunk port to VM

Passing through VLAN ID/tags to Hyper-V virtual machine NIC

This functionality is not exposed via the UI but here's an example of how to configure it via PowerShell.

Add-VMNetworkAdapter -SwitchName Switch -VMName "VmName" -Name "TrunkNic"
Set-VMNetworkAdapterVlan -Trunk -AllowedVlanIdList "100,101" -VMName "VmName" -VMNetworkAdapterName "TrunkNic" -NativeVlanId 1

 

https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc816585(v=ws.10)?redirectedfrom=MSDN#Anchor_2

https://docs.microsoft.com/en-us/archive/blogs/adamfazio/understanding-hyper-v-vlans

https://docs.microsoft.com/en-us/powershell/module/hyper-v/set-vmnetworkadaptervlan?view=winserver2012-ps&redirectedfrom=MSDN