pfSense Router Guide
Isometric padlock on a white pad linked by a cable to a dark firewall cube with glowing pink ports, with dashed pink lines outlining segmented network zones
networking

pfSense VLAN Configuration Explained: Tags, Rules, DHCP

How pfSense VLANs work end to end: parent interface, 802.1Q tags, interface assignment, DHCP, default-deny rules and the switch trunk config.

By pfSense Router Guide Editorial · ·Updated · 9 min read

Create an 802.1Q VLAN on a parent NIC in pfSense, assign it as an interface and give it a static IP address that clients can use as their gateway. Enable DHCP if clients need leases. Tag the VLAN on the switch trunk and add pass rules on the new interface to allow the traffic it needs. Netgate VLAN configuration, additional LAN setup, switch VLAN recipe

Verification was limited to Netgate’s pfSense documentation and the command reference manuals, checked on November 21, 2026. Netgate’s release notes cover pfSense Plus 26.07.2 and CE 2.9.2. Release notes

For edition differences, see pfSense CE vs pfSense Plus.

How does a VLAN work inside pfSense?

A pfSense VLAN is a virtual interface on a physical parent NIC. The 4-byte 802.1Q tag identifies the VLAN on the trunk, using an ID from 1 to 4094. Once assigned, the VLAN can have its own IP address, DHCP scope and firewall rules. VLAN overview, VLAN terminology, VLAN configuration

When a device connects to a host in another VLAN, pfSense routes between the assigned interfaces. Put the pass rule on the tab for the VLAN that initiates the connection. The firewall tracks the connection and permits reply traffic automatically. Firewall fundamentals, rule methodology

VLAN Tag Type selects the tag protocol identifier. Use C-Tag (0x8100) for ordinary single-tagged VLANs. S-Tag (0x88a8) is used as the outer tag in 802.1ad QinQ. VLAN configuration options

Dedicate the parent interface to carrying tagged VLANs and avoid using VLAN 1 on the trunk. Give switch management its own VLAN in this example and physically secure trunk ports. VLAN terminology, VLAN security

What does VLAN Priority do in pfSense?

VLAN Priority sets the 802.1p Priority Code Point (PCP) in the VLAN tag. The field accepts values from 0 to 7 and can be left blank, as in Netgate’s GUI example. VLAN configuration, VLAN priority

Use the interface setting to mark traffic for the VLAN. To match or mark specific traffic, use VLAN Priority (Match and Set) in the advanced options of a firewall rule. The upstream device must support 802.1p for the marking to affect priority there. Firewall rule options

What do you need before configuring VLANs?

Use a managed switch with 802.1Q trunking and a VLAN-capable network adapter. The tag can bring a full-size Ethernet frame to 1522 bytes. Hardware VLAN tagging or long-frame support helps avoid a reduction in MTU. Netgate VLAN requirements

A four-VLAN plan for a home network

This example uses IPv4 subnets from the private block 10.0.0.0/8. The third octet matches each VLAN ID. The example parent NIC is igb1. Use the physical port that carries your VLAN trunk. RFC 1918, VLAN terminology

VLANNameCIDRGatewayDHCP rangeIPv4 policy
10MGMT10.0.10.0/2410.0.10.1.100–.199Can initiate traffic to all VLANs and administer the firewall
20TRUSTED10.0.20.0/2410.0.20.1.100–.199Can reach IOT, the firewall’s DNS service and the internet
30IOT10.0.30.0/2410.0.30.1.100–.199Can use the firewall’s DNS service and reach the internet. Block access to other example VLANs.
40GUEST10.0.40.0/2410.0.40.1.100–.199Can use the firewall’s DNS service and reach the internet. Block access to other example VLANs.

How do you create a VLAN in the pfSense GUI?

Use your existing LAN management connection while making changes. The steps below build VLAN 30 (IOT). Repeat with the other IDs, names and addresses from the plan. Netgate’s anti-lockout rule

  1. Interfaces > Assignments > VLANs. Click Add. Set Parent Interface to igb1, VLAN Tag Type to C-Tag, VLAN Tag to 30, and Description to IOT. Leave VLAN Priority blank and click Save. VLAN configuration
  2. Interfaces > Assignments > Interface Assignments. Select the new VLAN under Available network ports and click Add. pfSense assigns the next available OPT interface. VLAN assignment example, additional LAN setup
  3. Interfaces > OPTx. Enable the interface and set its Description to IOT. Choose Static IPv4 and set the address and mask to 10.0.30.1/24. Leave IPv4 Upstream Gateway unset. Clear Block private networks and Block bogon networks, then click Save and Apply Changes. Additional LAN setup, IPv4 configuration types
  4. Services > DHCP Server > IOT. Enable DHCP and set the pool from 10.0.30.100 to 10.0.30.199. Click Save. Leave the gateway and DNS fields blank when pfSense is the gateway and runs the DNS Resolver. Additional LAN setup, DHCPv4 server options
  5. Firewall > Rules > IOT. Click Add for each rule below, then Save. After the rules are in order, click Apply Changes. Additional LAN firewall rules

For internet access, check Firewall > NAT > Outbound. In Automatic or Hybrid mode, verify that the new subnet is listed as a source under Automatic Rules. In Manual mode, add a rule with WAN as the interface, IPv4 as the address family and Any as the protocol. Use the VLAN subnet as the source, Any as the destination and WAN Address as the translation. Save and apply changes. Additional LAN outbound NAT

Use the GUI on an existing installation. The console’s Assign Interfaces VLAN setup warns that proceeding clears all existing VLANs. Console VLAN configuration

What firewall rules does a pfSense VLAN need?

A new VLAN interface needs pass rules for client traffic. Interface rules are evaluated in order, with the first match deciding what happens. Put DNS access and other intended exceptions before the broader blocks. Additional LAN firewall rules, firewall fundamentals

In Firewall > Aliases, click Add and create a Network(s) alias called RFC1918. Add 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, then save. Add the following rules in order on the IOT tab of Firewall > Rules, using IPv4 as the address family throughout. Isolated LAN example, firewall rule options

OrderActionProtocolSourceDestinationDestination portPurpose
1PassTCP/UDPIOT subnetsThis Firewall (self)DNS (53)Allow DNS to pfSense
2BlockAnyIOT subnetsThis Firewall (self)AnyBlock other firewall services
3BlockAnyIOT subnetsRFC1918AnyBlock other private IPv4 subnets
4PassAnyIOT subnetsAnyAnyPermit remaining IPv4 traffic, including internet access

Use the same order on GUEST with GUEST subnets as the source. For TRUSTED, use TRUSTED subnets as the source and insert a pass to IOT subnets before the RFC1918 block. On MGMT, add a pass from MGMT subnets to any destination. These are example rules for the four IPv4 networks above. Additional LAN firewall rules, firewall rule options

This Firewall (self) covers every firewall interface address, including its WAN IP. Rule 2 protects non-DNS services on those addresses before the final pass. Stateful filtering lets IOT hosts reply to connections initiated on TRUSTED. Firewall rule options, rule methodology

Rule-shadowing risks

  • If rule 4 is above rule 3, its broad pass also permits traffic to private subnets.
  • If rule 2 is above rule 1, DNS queries to the firewall hit the block first.
  • Floating rules and interface group rules are evaluated before interface rules. Check for a matching group block if a pass on the VLAN tab appears to have no effect. Rule methodology

Enable Log on the block rules you want to check, then look under Status > System Logs > Firewall. Firewall rule options, viewing the firewall log

If you plan to run an IPS on VLAN interfaces, see Snort vs Suricata on pfSense.

How should the switch and access points be configured?

Define the VLANs on the switch. Configure the port facing pfSense as a trunk that tags VLANs 10, 20, 30 and 40. Configure wired client ports as untagged members of one VLAN, and set the matching Port VLAN ID (PVID) where the switch requires it. Netgate switch VLAN recipe

Example portConnected deviceModeVLAN membership
p1pfSense igb1TrunkTagged 10, 20, 30, 40
p2VLAN-capable access pointTrunkTag each VLAN used for tagged traffic on the AP
p3Management computerAccessUntagged 10, PVID 10
p4DesktopAccessUntagged 20, PVID 20
p5IoT hubAccessUntagged 30, PVID 30
p6Wired guest deviceAccessUntagged 40, PVID 40

On the access point, match each SSID’s VLAN ID to the switch trunk. Use the AP’s own settings to determine which VLANs it expects tagged, including how it handles management traffic. Trunk and access port terminology

How do you get mDNS discovery working across VLANs?

Use an mDNS reflector between TRUSTED and IOT if devices need to discover each other. mDNS names are link-local, so discovery stays within each VLAN by default. The Avahi package can reflect those messages across the two networks. Leave GUEST out of the reflector. RFC 6762, Avahi package, Netgate’s bridging guide

With UDP Broadcast Relay, select TRUSTED and IOT as the interfaces and use UDP port 5353 with multicast group 224.0.0.251. Choose one service for mDNS because the relay cannot bind that port when Avahi is already using it. Discovery and the connection to the discovered device are separate. Keep the pass rule from TRUSTED to IOT for the connection itself. UDP Broadcast Relay configuration, rule methodology

What should you test before calling it done?

Start on an IOT client. Check that it receives a lease in the IOT pool and uses 10.0.30.1 as its gateway. If your DNS Resolver has custom interface bindings, verify that Network Interfaces includes IOT. By default the resolver listens on all available interfaces. DHCPv4 server options, DNS Resolver configuration

Use nslookup with the name first and the DNS server second. Run the pings from a client with BSD-style ping, where -c 4 sets the count. Choose an active TRUSTED test host that answers pings from an allowed network. BIND 9 nslookup manual, FreeBSD ping manual

nslookup pfsense.org 10.0.30.1   # expect a DNS answer (rule 1)
ping -c 4 10.0.20.1              # expect no replies from the firewall (rule 2)
ping -c 4 10.0.20.50             # expect no replies from the TRUSTED host (rule 3)

Check the firewall log to confirm the matching block rule when a ping receives no reply. Repeat the policy checks from GUEST. From TRUSTED, ping -c 4 10.0.30.50 should receive replies if the IoT test host answers ICMP. Viewing the firewall log, FreeBSD ping manual

Open a public website from IOT to check internet access. On a Debian client with mtr installed, mtr -r -w -c 20 9.9.9.9 generates a wide report after 20 cycles using one of Quad9’s public addresses. Use the report to inspect the route. Debian mtr manual, Quad9 service addresses

To measure routed throughput, run iperf3 -s on the IoT test host at 10.0.30.50. Allow the TRUSTED client to reach the server’s TCP port 5201 in the IoT host’s firewall. Run the commands below from TRUSTED. The first sends traffic toward IOT for 30 seconds, and -R reverses the direction of the data flow. ESnet iperf3 manual

iperf3 -c 10.0.30.50 -t 30
iperf3 -c 10.0.30.50 -t 30 -R

For hardware sizing and slow transfers, see pfSense workload sizing and finding the pfSense bottleneck.

To check the trunk, run the capture from the pfSense shell on the physical parent while an IoT client requests a lease. Here -i selects the interface, -n disables reverse DNS, -e displays the link-layer header and VLAN tag information, and -c 20 stops after 20 matching packets. The vlan 30 filter selects frames tagged with VLAN 30. Netgate tcpdump guide, Wireshark VLAN capture filter

tcpdump -n -e -i igb1 -c 20 vlan 30

If the capture shows no matching traffic during the lease request, verify the parent NIC, the access port’s VLAN and the trunk’s tagged membership. Netgate switch VLAN recipe

FAQ

Do VLANs slow down pfSense?

Adapters that require a lower MTU to carry tagged frames can send less data per packet. Netgate recommends adapters with long-frame support or hardware VLAN tagging for better efficiency. Netgate VLAN requirements

Sources

  1. VLAN Configuration - pfSense Documentation
  2. VLAN Priorities - pfSense Documentation
  3. VLAN Terminology - pfSense Documentation
  4. VLANs and Security - pfSense Documentation
  5. VLANs - pfSense Documentation
  6. Configuring Switches with VLANs - pfSense Documentation
  7. Configuring an OPT interface as an additional LAN - pfSense Documentation
  8. Firewall Fundamentals - pfSense Documentation
  9. Rule Methodology - pfSense Documentation
  10. Configuring Firewall Rules - pfSense Documentation
  11. Bridging and Wireless - pfSense Documentation
  12. Avahi package - pfSense Documentation
  13. UDP Broadcast Relay - pfSense Documentation
  14. DNS Resolver Configuration - pfSense Documentation
  15. RFC 6762: Multicast DNS
  16. RFC 1918: Address Allocation for Private Internets
  17. Plus 26.07.2 / CE 2.9.2 Release Notes - pfSense Documentation
  18. VLAN - Wireshark Wiki
  19. IPv4 Configuration Types - pfSense Documentation
  20. DHCPv4 Server - pfSense Documentation
  21. Viewing the Firewall Log - pfSense Documentation
  22. BIND 9 Manual Pages
  23. ping(8) - FreeBSD Manual
  24. mtr(8) - Debian Manpages
  25. Service Addresses & Features - Quad9
  26. Invoking iperf3 - ESnet Documentation
  27. Using tcpdump on the Command Line - pfSense Documentation

Related