pfSense VLAN Setup

Use this guide to configure VLANs in pfSense.

VLANs are a powerful tool for organizing and securing networks. They work by tagging Ethernet frames to create separate broadcast domains within the same physical infrastructure. This allows the network to be segmented logically, making it easier to group devices by purpose, improve performance, and enhance security across different use cases.

Enabling NAT

The first step is to ensure NAT is enabled for outbound traffic. This is important because it allows traffic leaving internal networks (including future VLANs) to successfully reach external networks such as the internet.

Click on the Firewall dropdown.

Select NAT.

Click on the Outbound tab.

Ensure Automatic Outbound NAT Rule Generation is selected.

Click Save.

Click Apply Changes.

Creating a VLAN

When creating a VLAN, there are two key considerations to keep in mind.

First, the IP address space (subnet) should be large enough to support both dynamic (DHCP) and static IP allocations without being unnecessarily oversized. Choosing the correct subnet size helps avoid wasting address space while still allowing room for growth.

Second, the dynamic and static IP ranges should be planned separately within the subnet. Each range should be sized appropriately for current devices while leaving room for future expansion.

A common best practice is to assign each VLAN a subnet using a unique third octet. For example, VLAN 2 might use the subnet 10.0.2.0/24. This makes VLANs easier to identify and troubleshoot at a glance.

Ensure VLAN assignments remain consistent across all network devices, including managed switches connected downstream from the pfSense router. Maintaining consistent VLAN configuration throughout the network helps ensure that traffic is properly segmented.

It is now time to create the first VLAN.

Step 1 - Create VLAN

Click on the Interfaces dropdown.

Select Assignments.

Click on the VLANs tab.

Click Add.

Set the following options.

Parent Interface: Router port the VLAN devices will connect through

VLAN Tag: Unique number used to identify the VLAN

VLAN Priority: 0

Description: Description of the VLAN

Example

Click Save.

Click Apply Changes.

Step 2 - Assign the VLAN Interface

Click on the Interfaces dropdown.

Select Assignments.

Next to Available Network Ports, select the new VLAN from the dropdown.

Click the +Add button.

Click Save.

Click Apply Changes.

Step 3 - Configure the VLAN Interface

Click on the new VLAN interface name on the left-hand side.

Set the following options.

Enable: ☑ Enable Interface

Description: Description of the VLAN

IPv4 Configuration Type: Static IPv4

IPv4 Address: 10.0.X.1/24 (Replace X with the third octet assigned to the VLAN subnet)

Example

Click Save.

Click Apply Changes.

Step 4 - Enable DHCP

Click on the Services dropdown.

Select DHCP Server.

Click on the tab for the new VLAN.

Set the following options.

Enable: ☑ Enable DHCP Server on the VLAN interface

Address Pool Range: Replace X with the third octet assigned to the VLAN subnet.

From: 10.0.X.2

To: 10.0.X.X (The final octet determines the end of the dynamic DHCP range)

Example

Click Save.

Click Apply Changes.

Step 5 - Create Firewall Rules

Create two firewall rules. These rules will:

  • Block access to the pfSense webConfigurator from the VLAN
  • Allow the VLAN to access the network and internet

Click on the Firewall dropdown.

Select Rules.

Rule 1 - Block Access to webConfigurator

IMPORTANT: Ensure the computer used to manage pfSense is not connected to the VLAN currently being configured. Do not apply this rule to the dedicated management/configuration VLAN.

This rule blocks access to the pfSense webConfigurator from the VLAN.

Click Add.

Set the following options.

Action: Block

Interface: VLAN Interface Name

Address Family: IPv4

Protocol: TCP

Source: Any

Destination: This Firewall

Destination Port Range:

From: Other

Custom: pfSense webConfigurator port number

To: Other

Custom: pfSense webConfigurator port number

Log: ☑ Log packets handled by this rule

Description: Block webConfigurator Access

Click Save.

Click Apply Changes.

Rule 2 - Allow VLAN Access

Next, allow the VLAN to access the rest of the network and the internet.

Click Add.

Set the following options.

Action: Pass

Interface: VLAN Interface Name

Address Family: IPv4

Protocol: Any

Source: VLAN Interface Subnet

Destination: Any

Description: Default Allow VLAN to Any

Click Save.

Click Apply Changes.


Loading...