OPNsense Firewall Configuration
This page details my OPNsense firewall setup, used for advanced traffic management, VPN, DNS filtering, and monitoring in my home lab. Sensitive data is redacted for privacy while still providing insight into my secure architecture.
System Overview
- Platform: OPNsense runs on a dedicated 4-port Protectli Vault appliance optimized for security and performance.
- Networking: Intel NICs provide stable multi-zone routing with VLAN tagging and hardware offloading support.
- Segmentation: Network zones are logically separated by physical ports and tagged interfaces to enforce policy boundaries.
- Reliability: Configuration backups are encrypted, versioned, and automatically replicated off-site.
- Resilience: Changes are snapshot-backed before major updates, ensuring quick rollback if needed.
Firewall Rules
Rules are defined per interface: WAN, LAN, VLANs. Highlights include:
- Default deny on WAN
- Granular access between VLANs based on aliases
- Allow lists for DNS, HTTPS, and VPN traffic
Aliases and schedules simplify rule management and enforce policies like screen time for certain devices.
Step-by-Step Instructions
STEP 1: Configure Default WAN “Deny All”
- Go to Firewall > Rules > WAN.
- Delete any "allow all" default rule (if it exists).
- Confirm there is a default "block all" rule at the bottom (gray background). This will drop unsolicited inbound traffic.
- Result: WAN blocks all unsolicited inbound unless explicitly allowed (e.g., for port forwards).
STEP 2: Create Aliases for Devices & Services
- Go to Firewall > Aliases > IP..
- Click + Add.
-
Fill in:
- Name: IOT_DEVICES
- Type: Host(s)
- Content: Add IPs or hostnames (e.g., 192.168.10.10, 192.168.10.11)
- Description: "IoT devices group"
- Repeat for other groups like GUEST_DEVICES, WORK_DEVICES, etc.
-
Create aliases for services like DNS, HTTPS, VPN:
- Name: DNS_SERVICES
- Type: Port(s)
- Content: 53 (DNS)
- Description: "DNS services"
- Result: Aliases simplify rule management by grouping devices/services.
STEP 3: Configure LAN & VLAN Rules (Allow List Approach)
- Go to Firewall > Rules > [Your VLAN Interface] (e.g., VLAN_IOT)
-
Fill in:
- Action: Pass
- Interface: VLAN_IOT
- Source: IOT_DEVICES (or any if not using aliases yet)
- Destination: any
- Destination Port: DNS (alias)
- Protocol: TCP/UDP
- Description: "Allow DNS for IOT"
-
Add rule for HTTPS
- Action: Pass
- Interface: VLAN_IOT
- Source: IOT_DEVICES
- Destination: any
- Destination Port: HTTPS (alias)
- Protocol: TCP
- Description: "Allow HTTPS for IOT"
-
Add rule to allow access to specific VLANs (Granular Inter-VLAN):
- Source: IOT_DEVICES
- Destination: WORK_DEVICES (or just VLAN20 subnet)
- Protocol: any
- Description: "Allow IOT access to Work VLAN Devices"
- Tip: Only create access rules where required. Avoid wide-open any-to-any rules between VLANs.
STEP 4: Enforce Rules by Time (Schedules like “Screen Time”)
- Go to Firewall > Schedules.
- Click + Add.
- Set a name like SCREEN_TIME_KIDS.
- Click in the time grid to select allowed hours (e.g., weekdays 4–7 PM).
- Go to Firewall > Rules > VLAN_KIDS.
- In the rule, scroll down to Schedule and select SCREEN_TIME_KIDS.
- Below that, make sure "State Type" is sloppy state or none to avoid lingering states after block.
- Add a "Block all" rule without a schedule below the scheduled "pass" rule.
- Result: This blocks internet access outside allowed times.
STEP 5: Apply, Test & Monitor
- Apply changes at the top after adding or editing rules.
- Use Firewall > Diagnostics > States Dump to clear states if testing (especially with schedules).
-
Monitor live traffic via:
- Firewall > Log Files > Live View
- Firewall > Rules > [Your VLAN Interface] to see rule hits
- Filter by source IP to test if access is working/blocked as expected.
DNS & DHCP
- Unbound DNS with DNSSEC and DNS-over-TLS
- Host overrides for static services
- Multiple DHCP scopes with static mappings
VPN Configuration
- WireGuard for secure remote access
- Access controls via firewall and aliases
- Manual and automatic peer management
Monitoring & Reporting
- System metrics: CPU, RAM, disk, NIC throughput
- Detailed firewall rule hits and traffic graphs
- Monit service status check (alerts disabled)
Security Enhancements
- Spoof protection and anti-replay options enabled
- Suricata IPS configured in inline mode
- 2FA enabled for Web UI access
Backup & Restore
- Encrypted config exports with SHA256 checksums
- Snapshotting before major updates
- Tested backups to validate them