> Advanced Professional Guide — pfSense 2.7+ · FreeBSD · OpenVPN · IPsec · VLAN · HAProxy · Snort / Suricata
Table of Contents
- Hardware & Environment Requirements
- Installing pfSense
- Initial configuration & interfaces
- Advanced firewall rules
- VLAN & network segmentation
- VPN — OpenVPN & IPsec
- IDS/IPS — Snort & Suricata
- High availability (CARP)
- Monitoring & alerts
- Best practices & hardening
1. Hardware & environment prerequisites
pfSense is based on FreeBSD and requires dedicated or virtualized hardware for optimal performance in production.
| Component | Minimum | Recommended (Production) | Notes |
|---|---|---|---|
| CPU | 64-bit, 1 GHz | Intel AES-NI, 4+ cores | AES-NI required for high-performance VPN |
| RAM | 1 GB | 8 GB+ | 16 GB if IDS/IPS enabled |
| Storage | 8 GB SSD | 64 GB SSD NVMe | Logs & resource-intensive packages |
| Network interfaces | 2 NICs | 4+ Intel/Broadcom NICs | Avoid Realtek NICs in production |
| Connectivity | 100 Mbps | 1–10 Gbps | Depending on traffic volume |
> ℹ️ Info — For virtualization (VMware ESXi / Proxmox), enable NIC passthrough (SR-IOV) for near-bare-metal performance. Avoid virtual NICs for production.
*Fig. 1.1 — Complete network architecture with pfSense as a border firewall, VLAN segmentation, and VPN*2. Installing pfSense
Download the ISO image from netgate.com and create bootable media.
Installation steps
- Download the official ISO from netgate.com/pfsense-plus-software (CE or Plus version depending on license)
- Create a bootable USB drive with Balena Etcher or Rufus (UEFI recommended)
- Boot from the USB drive — select Install pfSense from the menu
- Choose the partitioning mode: Auto ZFS recommended for redundancy
- Select the target disk — confirm data destruction
- Reboot after installation and remove the media
> ⚠️ Warning — Never install pfSense on the same disk as other systems. Partitioning completely erases the target disk.
*Fig. 2.1 — pfSense installation flow in 6 steps — step 4 (ZFS) is critical*3. Initial configuration & interfaces
On first boot, pfSense launches a wizard accessible via the WebGUI at https://192.168.1.1.
Initial WebGUI access
URL: https://192.168.1.1
Login: admin
Password: pfsense
⚠ Change the password immediately via System > User Manager
Interface assignment
Navigate to Interfaces > Assignments. Identify each physical interface via its MAC address or via the built-in cable disconnect test.
| Interface | Role | Recommended address |
|---|---|---|
| WAN | ISP/Internet connection | DHCP or static ISP IP |
| LAN | Main internal network | 192.168.1.1/24 (to be changed) |
| OPT1 | DMZ / Exposed servers | 10.0.10.1/24 |
| OPT2 | OOB management | 172.16.0.1/24 |
4. Advanced firewall rules
pfSense uses pf (Packet Filter FreeBSD) as its engine. Rules are applied top to bottom, with the first matching rule winning.
> 🚫 Critical — Never use the "any to any" rule in production. Always define named aliases and rules per service.
Creating aliases
Alias: ADMIN_HOSTS
Type: Host(s)
IPs: 10.0.0.10, 10.0.0.11, 172.16.0.5
Alias: WEB_SERVICES
Type: Port(s)
Ports: 80, 443, 8443
Example of LAN → WAN rules
| Action | Proto | Source | Dest. | Port | Description |
|---|---|---|---|---|---|
| PASS | TCP | LAN net | any | 443 | Outgoing HTTPS |
| PASS | UDP | LAN net | DNS servers | 53 | Authorized DNS |
| PASS | TCP/UDP | ADMIN_HOSTS | any | any | Full admin access |
| BLOCK | any | any | any | any | Implicit deny-all |
5. VLAN & network segmentation
Segmentation via VLAN (802.1Q) is essential for isolating traffic and limiting the impact of a compromise.
VLAN configuration on pfSense
- Navigate to Interfaces > VLANs — Click Add
- Select the parent interface (e.g.,
igb1) and enter the VLAN ID (e.g., 20) - Assign the VLAN created in Interfaces > Assignments
- Enable the interface and configure its IP address
- Create inter-VLAN firewall rules according to the security policy
> ℹ️ Info — Configure the upstream switch in trunk mode on the port connected to pfSense. Use a dedicated native VLAN (non-1) for management.
*Fig. 5.1 — Segmentation into 4 VLANs with 802.1Q trunk to pfSense*6. VPN — OpenVPN & IPsec
pfSense natively supports OpenVPN (remote access) and IPsec (site-to-site).
OpenVPN — Secure remote access
- Create an internal CA: System > Cert. Manager > CAs > Add
- Generate a server certificate: System > Cert. Manager > Certificates
- Navigate to VPN > OpenVPN > Servers > Add
- Configure: Protocol UDP, port 1194, TLS Authentication enabled
- Choose the tunnel network (e.g.,
10.8.0.0/24) and push the LAN routes - Create the WAN rule: allow incoming UDP 1194
- Export the client configurations via the openvpn-client-export package
# Recommended secure settings
tls-version-min 1.2
cipher AES-256-GCM
auth SHA256
tls-auth ta.key 0
remote-cert-tls server
IPsec — Site-to-site tunnel (IKEv2)
| Phase | Setting | Recommended value |
|---|---|---|
| Phase 1 | IKE Version | IKEv2 |
| Phase 1 | Encryption | AES-256 |
| Phase 1 | Hash | SHA-256 |
| Phase 1 | DH Group | 14 (2048-bit) |
| Phase 2 | Protocol | ESP |
| Phase 2 | Encryption | AES-256-GCM |
| Phase 2 | PFS | Group 14 |
7. IDS/IPS — Snort & Suricata
pfSense integrates Snort and Suricata as IDS/IPS packages. Suricata is preferred for its multi-thread performance.
Installing Suricata
- Navigate to System > Package Manager > Available Packages
- Search for and install Suricata
- Go to Services > Suricata > Interfaces — Add WAN
- Enable rule sources: AND Open, Snort Community Rules
- Configure the mode: IDS (alert) first, then IPS (block) after validation
- Enable false positive suppression via suppression lists
> ⚠️ Warning — Always start in IDS only mode to analyze false positives before enabling blocking.
*Fig. 7.1 — Suricata pipeline: IDS (alert) vs IPS (block)*8. High availability (CARP)
pfSense implements high availability via CARP and pfsync for state synchronization between active and passive nodes.
HA Configuration
- Configure a dedicated pfsync interface (isolated synchronization network)
- On the Master: System > High Avail. Sync — enable pfsync, configure the peer IP
- Create CARP VIPs on each interface (WAN, LAN, etc.)
- Configure rules and services to use VIPs as addresses
- Test failover by stopping the Master and verifying automatic failover
> ✅ Good to know — With HA configured correctly, failover time is less than 1 second thanks to pfsync synchronization.
*Fig. 8.1 — HA architecture with shared CARP VIPs and pfsync*9. Monitoring & alerts
Good monitoring combines internal pfSense logs, SNMP/syslog export, and external tools.
External syslog configuration
System > Advanced > Notifications
Remote Log Servers: 10.0.10.50:514
Protocol: UDP
Log contents: Firewall Events, DHCP, VPN, System
SNMP for network monitoring
- Install the Net-SNMP package via the manager.
- Configure the SNMP v3 community with authentication (avoid v1/v2c).
- Restrict SNMP access to monitoring IPs only.
- Integrate into Zabbix or LibreNMS with pfSense OIDs.
10. Best practices & hardening
| Area | Action | Priority |
|---|---|---|
| Authentication | MFA on WebGUI (TOTP) | 🔴 CRITICAL |
| Access | WebGUI only on LAN/MGMT interface | 🔴 CRITICAL |
| Protocols | Disable HTTP, enforce HTTPS + HSTS | 🔴 CRITICAL |
| SSH | Public key only, non-standard port | 🟠 HIGH |
| Updates | Regular patches, snapshots before updates | 🟠 HIGH |
| Logs | External syslog export + min. 90-day retention | 🟠 HIGH |
| Backup | Daily automated encrypted config export | 🟡 STANDARD |
| DNS | DNS Resolver with DNSSEC enabled | 🟡 STANDARD |
> 🔐 Critical — Never expose the WebGUI on the WAN. If remote access is necessary, always use the VPN.
*Fig. 10.1 — pfSense hardening measures — reducing the attack surface*pfSense™ is a registered trademark of Netgate. This tutorial is provided for educational purposes.