Skip to content
Geek is the Way!
Menu
  • Forums
  • Sobre o blog
  • Contato
  • English
    • Português
Menu

Setup VLAN subnets on pfSense

Posted on December 23, 2020October 16, 2022 by Thiago Crepaldi

Last Updated on October 16, 2022 by Thiago Crepaldi

This is another topic that I have referenced so many times that I decided to dedicate a post just for it and save some typing. The goal is to configure a VLAN subnet that has DHCP server and basic firewall rules to allow any traffic on your pfSense. This VLAN will be created from the LAN interface unless otherwise stated. Future posts can make other changes to achieve different results too, but they will be highlighted in advance.

The basic parameters are listed below. I recommend using a VLAN between 2 and 254, so that we can use VLAN ID as part of the third IP octet. For this post, the following values will be used:

  • LAN Address: 10.20.100.1/24
  • VLAN ID: 100
  • DHCP Range: 10.20.0.100-10.20.100.199
  • NTP/DNS server: 10.20.100.1
  • Domain name: lan.domain.com
  • Firewall: Default allow all traffic

For this example, not that the network address has the third octet matching the VLAN ID (aka 100). This is intentional to help identifying traffic during packet capture in future investigation.

Future posts will specify these values for their use, so pay attention!

On your pfSense, go to Interfaces >> Assignments >> VLANs, click on Add and do as follow:

  • VLAN Configuration
    • Parent Interface: Select the interface created for the LAN
    • VLAN Tag: 100
    • Description: VLAN 100 – Descriptive name for this VLAN

Press Save and Apply changes. Now go to Interfaces >> Assignments >> Interface assignments and add a new interface with the newly created VLAN:

  • General Configuration
    • Enable interface: checked
    • Description: Any descriptive name, such as VLAN100
    • IPv4 Configuration Type: Static IPv4
  • Static IPv4 Configuration
    • IPv4 address: 10.20.100.0/24

Click on Save and Apply changes. As before, the next step is to configure DHCP for the new interface. Navigate to Services >> DHCP Server >> VLAN100 (or however you named your interface):

  • General Options
    • Enabled: checked
    • Range: 10.20.100.100 to 10.20.100.199
  • Servers
    • DNS servers: 10.20.100.1
  • Other Options
    • Domain name: lan.domain.com
    • NTP Server 1: 10.20.100.1

Leave the rest as is and press Save at the bottom. As before, the next step is to create firewall rules to allow internet traffic. As discussed before, you can duplicate each firewall rule from the main LAN interface if you have pfBlockerNG and/or DNS stuff. We will also add a new rule to allow all traffic. Go to Firewall >> Rules and press Add

  • Edit Firewall Rule
    • Action: Pass
    • Interface: VLAN100
    • Address Family: IPv4
    • Protocol: Any
  • Source
    • Source: VLAN100
  • Destination
    • Destination: Any
  • Extra Options
    • Description: Default allow all rule

Finish by clicking on Save and Apply changes. Now your VLAN network has internet access.

(Optional) Configuring VLAN on Unifi switches

At this point, the VLAN on the pfSense is up and running, allowing traffic to flow towards Internet. However, in order to devices in the network to be able send/receive packets to/from the VLAN, all switches between the pfSense (where the VLAN was created) and the devices need to allow traffic from this VLAN. Only managed switches can handle VLAN traffic; while non-managed switches do not understand this concept and drop packages that arrive on its port targeting the VLAN.

For this post, I will use a Unifi switch as an example.

On your Unifi web UI, go to Settings >> Networks page and click on Add a new network:

  • Name: VLAN_100
  • Router:
    • VLAN-only network: checked
  • VLAN ID: 100
  • IGMP Snooping:
    • Enabled: unchecked
  • DHCP Guarding:
    • Enable: unchecked

Click Add network to finalize the configuration. From now on, any device connected to this switch and reach the pfSense/Internet through the VLAN. This happens because, by default, all ports of the Unifi switches are configured to allow traffic from all “port profiles”. This behavior can be changed to constraint which physical port can accept traffic from which VLAN, but we don’t need this for now.

Share this:

  • Tweet

Related

1 thought on “Setup VLAN subnets on pfSense”

  1. Pingback: Routing Internet Traffic Through a Site-to-Site IPsec VPN on a specific Wi-fi over VLAN - Geek is the Way!

Leave a ReplyCancel reply

LIKED? SUPPORT IT :)

Buy Me a Coffee


Search


Categories

  • Cooking (1)
  • Homelab (79)
    • APC UPS (6)
    • pfSense (40)
    • Proxmox (20)
    • Shopping (1)
    • Supermicro (2)
    • Synology NAS (8)
    • Ubiquiti (6)
    • UDM-Pro (4)
  • Random (3)
  • Wordpress (1)

Tags

Agentless monitoring (3) AP9631 (3) Apache2 (3) APC UPS (6) Bind9 (3) CA (2) certificates (5) cron (2) DDNS (5) debian (3) DNS (7) DSM (6) Dynamic DNS (4) Firewall (9) gmail (3) Let's Encrypt Certificates (7) Linux (2) LXC (2) monitoring (18) networking (21) PBS (3) pfsense (43) port forwarding (3) proxmox (17) proxmox backup server (3) proxmox community (2) proxmox virtual environment (16) pve (5) rev202207eng (76) routing (2) security (28) SNMP (4) SNMPv1 (3) ssh (4) SSL (6) Synology (7) udm-pro (5) unifi (6) unifi controller (3) UPS (5) VLAN (4) vpn (9) wifi (4) Zabbix (18) Zabbix Agent2 (11)

See also

Privacy policy

Sitemap

©2025 Geek is the Way! | Design by Superb