Hyper-V and PFsense with Vlans

Hyper-V and PFsense with Vlans

Making a mental note, here. I’ve tried visualizing PFsense multiple times in the past with mostly failures. The reason being is Hyper-V and VLANS.

I assumed by default a vSwitch would pass all traffic. By default this doesn’t seem to be the case.

You must setup your vSwitch correctly.

Here is the command i used that worked.

Get-VMNetworkAdapter -VMName “vmname” | Where-Object {$.MacAddress -eq “XXXXXXXXXXXX”} | Set-VMNetworkAdapterVlan -Trunk -AllowedVlanIdList “1-100” -NativeVlanId 1



Also take a look here

Hyper-V VM Trunk VLANs

Posted by virutalisto on May 19, 2017

Virtual Firewalls, routers or other networking appliances usually require access to several VLANs. It is not feasible in such scenarios to have a network interface for each VLAN and Hyper-V does not provide and easy method to allow multiple VLANs to be trunked to the VM. It would almost seem that this is not possible at all in Hyper-V, while VMware vSphere has an easy way to configure a port group with multiple VLANs.

After a bit of research I found that it is actually possible to do this using the powershell command Set-VMNetworkAdapterVlan . The full command to be executed is as below.PowerShell

1Set-VMNetworkAdapterVlan -Trunk -AllowedVlanIdList “200,300” -VMName “VmName” -VMNetworkAdapterName “TrunkNic” -NativeVlanId 1

The following parameters must be provided.

-AllowedVlanIdList  This is a list of comma separated VLAN IDs. It could also be a range such as 2-4094
-VMName This is the name of the VM for which this change is being done.
-VMNetworkAdpaterName This specifies the name of the Virtual NIC in the VM Settings and it is therefore preferable to create the network adapter using Powershell as well to customize the name.
-NativeVlanId A native VLAN ID must be specified for untagged traffic.

Leave a Reply