Skip to content

PfSense VLAN with Hyper-V

So, in a lab environment I was trying to run a VLAN via PfSense. Since I have only 1 WAN connection available and wanted a separated LAN with internet connectivity.
This caused some connection issues as the Hyper-V does not support VLAN Trunk without setting this up manually via Powershell.

First lets set up the PfSense for VLAN;

Create a new VLAN interface:

2017-03-03_145913

Assign the VLAN interface to the LAN interface:

2017-03-03_145933

Next we set up firewall rules to allow traffic:

2017-03-03_150035

Set up the DHCP server for the VLAN interface (if required):

Now we have setup the VLAN, this still does not guarantee connectivity within the VM, even when the VLAN ID is entered in the VM Settings.

2017-03-03_150632

What we need to do is enable the VLAN Trunk on the PfSense VM network adapter(s). The can be done via a Powershell command, which in my case would look like this:

Set-VMNetworkAdaptervlan -VMName Aad_FW01 -Trunk -AllowedVlanIdList "0, 10, 30" -NativeVlanId 0

Now when we get the VM Network VLAN settings we should see something like this.

2017-03-03_150219

You should have connectivity on the VLAN enabled Virtual Machine now.

What you can also do is set it to one specific network adapter by changing the name of the adapter via doing the following:

Remove-VMNetworkAdapter -VMName <VMName> -Name "Network Adapter"
Add-VMNetworkAdapter -VMName <VMName> -Name <AdapterName>
Published inHyper-VPfSenseServer 2016Windows Server

4 Comments

  1. Brian Brian

    Thanks! This fixed it for me.

  2. Bob Bob

    I was having issues with my pfsense LAN card with after setting trunk port with native vlan ID 1. I’d lose ping immediately after entering command. Then receive ping reply after setting native vlan ID to 0 Thanks for instructions, it works after setting native vlan ID to 0 , but I dont know why?
    Would you have answer why do we have native vlan 0 instead of 1?
    Thank you

  3. Joe Joe

    Thanks a lot, works creat!

  4. Stephen Stephen

    Thank you so much! I’ve been trying to get this working for the better part of three days.

Leave a Reply to Bob Cancel reply

Your email address will not be published.