Firewalls are the single most important security device in any network. For years, dedicated hardware was the only serious option — a Protectli, a Netgate, or a MikroTik running the show. But if you already run Proxmox, virtualizing your firewall is cheaper, more flexible, and arguably more secure when done right.
This guide covers a production-grade OPNsense deployment as a Proxmox VM with:
- VM setup with virtio NICs and optimal resource allocation
- WAN/LAN bridge topology on the Proxmox host
- VLAN trunking and inter-VLAN firewall rules
- Suricata IDS/IPS inline on LAN interfaces
- WireGuard VPN for remote access
- DNS, DHCP, and security hardening
Why OPNsense for a Virtualized Firewall?
OPNsense is a FreeBSD-based firewall that started as a pfSense fork but has since surpassed it in several areas: a cleaner web UI, regular 2-week release cycles, built-in WireGuard, native Suricata in business edition, and a plugin system without bloat. For a Proxmox homelab, it fills the gap between MikroTik RouterOS (powerful but CLI-heavy) and pfSense (stable but slower-moving).
Compared to running a MikroTik virtualized, OPNsense gives you:
- Full IDS/IPS with Suricata or Zenarmor (Sensei)
- WireGuard built into the kernel (MikroTik added it later, but CLI-only initially)
- Unbound DNS with DNSSEC, blocklists, and overrides baked in
- VLAN management through a web GUI — no
/interface vlancommands
Proxmox VM Setup for OPNsense
VM Specifications
Create the VM with these specs:
- CPU: 2 vCPU cores (host type for AES-NI access)
- RAM: 4 GB minimum, 8 GB if running Suricata in IPS mode
- Disk: 32 GB on fast storage (ZFS mirror or NVMe)
- NIC1 (WAN): VirtIO (paravirtualized) — bridged to vmbr0
- NIC2 (LAN): VirtIO — bridged to vmbr1
- Enable hardware virtualization: check “Processor” options for aes flags
Proxmox Bridge Configuration
Before creating the VM, set up two bridges on your Proxmox host. Modify /etc/network/interfaces:
|
|
Critical detail: do NOT assign an IP address to either bridge on the Proxmox host. The host’s management IP should be on a VLAN interface within OPNsense. This keeps Proxmox behind the firewall.
Install OPNsense
|
|
Boot the VM, attach to console, and run through the installer:
- Select ZFS as filesystem (auto layout)
- Set root password
- Reboot, remove ISO
After first reboot, assign interfaces:
- WAN: vtnet0 (your NIC1 / vmbr0)
- LAN: vtnet1 (your NIC2 / vmbr1)
Set the LAN IP to 10.0.0.1/24 temporarily for first web GUI access, then immediately change it to a more structured IP like 10.0.10.1/24 for your management VLAN.
VLAN Trunk Configuration
From the OPNsense web GUI, create VLANs on the LAN interface (Interfaces → Other Types → VLAN):
| VLAN ID | Name | Description |
|---|---|---|
| 10 | mgmt | Management — servers, hypervisors |
| 20 | trusted | Trusted user devices, workstations |
| 30 | iot | IoT devices — cameras, sensors, smart plugs |
| 40 | guest | Guest WiFi — internet only, isolated |
| 99 | dmz | DMZ — public-facing services |
After creating VLANs, assign each one (Interfaces → Assignments), enable them, and set IPs/DHCP:
|
|
Inter-VLAN Firewall Rules — Lock It Down
By default, OPNsense allows all traffic. You need explicit deny rules. The approach:
- Default deny all inter-VLAN traffic at the top of each VLAN interface
- Allow established/related state tracking
- Explicit allow only what’s needed
Example — IoT VLAN rules (interface: IoT, direction: in):
|
|
The !10.0.0.0/8 in Rule 4 means “destination is NOT in RFC1918 space” — internet only. This keeps IoT devices from phoning home to your servers while still getting firmware updates.
Guest VLAN rules — allow DNS and internet only:
|
|
Suricata IDS/IPS — Inline on LAN
Install the Suricata plugin: System → Firmware → Plugins → os-suricata.
Suricata Configuration
Navigate to Services → Suricata → Settings:
|
|
After enabling, go to the Updates tab and download the Emerging Threats Open ruleset:
|
|
Reducing False Positives
Suricata in IPS mode will block traffic matching rules. Start in IDS (alert-only) mode for 48 hours:
|
|
Common suppressions for homelabs:
- SMB traffic between your workstation and NAS
- Plex media streaming to LAN clients
- DNS queries to your internal resolver
After tuning, switch to IPS mode. Suricata IPS on a 4-core VM handles 500 Mbps comfortably. For 1 Gbps, give it 4 vCPU and verify your NICs use VirtIO (not e1000).
WireGuard VPN Server
OPNsense includes WireGuard in the base install — no plugin needed since 25.1. Navigate to VPN → WireGuard.
Server Config
|
|
Peer Config
|
|
The Allowed IPs include the WireGuard tunnel address and your entire LAN. This means when connected, your client can reach any device in any VLAN.
WAN Firewall Rule
|
|
NAT for VPN Clients
If you want VPN clients to reach the internet through OPNsense, add an outbound NAT rule:
|
|
DNS and DHCP Best Practices
OPNsense runs Unbound as the local DNS resolver. Enable it with blocklists:
Services → Unbound DNS → General:
|
|
DNS over TLS (DoT) for upstream queries:
|
|
DHCP static mappings per VLAN:
|
|
With “Register DHCP static mappings” enabled, Unbound automatically adds A and PTR records for every static lease. No manual /etc/hosts editing.
Security Hardening Checklist
Before putting this firewall into production, lock it down:
- System → Settings → Administration: disable web GUI on WAN and change port to 8443
- System → Settings → SSH: bind to LAN only, disable password auth, use key-only
- System → Access → Users: enable 2FA (TOTP) for admin and your user
- Firewall → Settings: disable ICMP redirects, disable directed broadcast
- System → Firmware → Settings: set update branch to “Business” (stable, 2-week cycle)
- System → Settings → Tunables: enable TCP SYN cookies, set
net.inet.tcp.blackholeto2
To verify your hardening from outside, use a VPS or mobile hotspot (not on your network):
|
|
Monitoring and Logging
OPNsense’s firewall live view is useful for debugging, but for long-term retention, export logs:
Syslog to Loki/Grafana — configure in Services → Syslog → Settings:
|
|
Netflow export — install os-netflow plugin and send to Grafana via:
|
|
Conclusion
Virtualizing OPNsense on Proxmox is not a compromise. With VirtIO NICs, proper bridge topology, and enough resources for Suricata, your virtual firewall outperforms many dedicated appliances. The real value is in the flexibility — you can snapshot the firewall VM before config changes, clone it for testing, and migrate it between Proxmox hosts.
For your first week, run Suricata in IDS-only mode while tuning down false positives. Lock down WAN access to the admin GUI immediately. Start with management and IoT VLANs, then expand to guest WiFi and DMZ as you gain confidence.
Next steps: add CARP for high-availability with a second Proxmox host, integrate with Authentik for LDAP authentication, and set up Zenarmor (Sensei) for application-level traffic control.