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:
Assign the VLAN interface to the LAN interface:
Next we set up firewall rules to allow traffic:
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.
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.
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>
Thanks! This fixed it for me.
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?
Thanks a lot, works creat!
Thank you so much! I’ve been trying to get this working for the better part of three days.