VLAN Trunking in Hyper-V for VCL

Modified on Mon, 14 Feb 2022 at 09:53 PM

To use multiple VLANS within Hyper-V VLAN Trunking must be enabled on each VCL LAN adapter. Unfortunately this is not straightforward within Hyper-V and cannot be done from the GUI.

Step 1: Decide what VLANs will be used and what VCL LAN adapters they reside on. Go ahead and set these up in the VCL -

Step 2: In the Hyper-V settings for any VMs go into the Network Adapter and set the desired VLAN.

Step 3: Turning on VLAN Trunking for any VCL LAN adapters. Open Windows Powershell with Admin rights.

Hyper-V unfortunately names every adapter as "Network Adapter".

We will need to display them by MAC to figure out which is which (especially if there is more than one VCL LAN).

Let's execute this again but store the results in an array variable that we can use. As you can see "$VMNetAdap[1]" equates to the LAN adapter, while "$VMNetAdap[0]" would be the WAN adapter.

Now using the array index you can rename the adapters.

Once the adapters have been renamed we can now use those names to identify the adapter to Trunk. VLANS can be added as a range or comma separated.

Once this is done your VM should be available on and the VLAN and get an address if DHCP.