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>