OPNsense Business 26.10 on FreeBSD: A Small VPN, a Large Forwarding Cost
Measured software, November 2026: FreeBSD-based OPNsense Business 26.10.0p1, running FreeBSD 15.1-RELEASE-p6 (base/kernel package 26.7.9).
Scope: November 2026; a 16-core x86-64 firewall appliance with approximately 64 GiB RAM and a 10 Gb/s wide area network (WAN) service. Both phases of the main comparison ran on the same boot. Earlier tuning used Business 26.4.1p2 / FreeBSD 14.3-RELEASE-p16. Measurements used ordinary cumulative counters; no new Tor instrumentation. Internet/upstreams, public-relay hosts and Management local area networks (LANs) A/B are anonymous roles.
During a reported Tor-associated traffic flood, the router was receiving about 1.3 million packets/s across its WAN and LAN and tracking about 4.6 million firewall states. Moving the small management virtual private network (VPN) from IPsec to WireGuard and removing its ordinary IPsec policies cut system-plus-interrupt CPU cost per received packet by 51%. The result comes from 28 comparisons: each matches a 30-second router sample before the change with one after it at similar traffic load.
The VPN change cut CPU use. Total busy CPU on the 16-core x86-64 router fell from 79% to 39% while it received about the same number of packets. Both phases used the same boot, kernel and major settings.
More states fixed allocation failures, not CPU stalls. The router had about 64 GiB RAM, with about 43 GiB free initially. We raised the state limit from 6,536,100 to 10,000,000. That stopped new allocation failures.
CPU cost was still lower 12 days later. Saved counters spanning the 12-day follow-up showed an average of about 4,812 core-nanoseconds per received packet, close to the earlier post-migration results.
1. A different forwarding path, at matched load
On the measured FreeBSD 15.1-RELEASE-p6 kernel, ordinary IPsec security policy database (SPD) entries kept IPv4 traffic from using the fast-forward path in that virtual network stack (VNET). Removing those entries let eligible packets use fast forwarding while retaining packet-filter (PF) checks. The counted fast-forward fraction rose from 0% to more than 99%. Pinned input path · PF hooks.
| Measured object | IPsec before | WireGuard after |
|---|---|---|
| Valid 30-second intervals | 30 of 30 | 30 of 30 |
| Compared samples | 28 intervals · 14 minutes · 93% | 28 intervals · 14 minutes · 93% |
| Busy CPU, entire 16-core x86-64 router | 79% | 39% |
| System CPU / interrupt CPU | 79% / <1% | 38% / <1% |
| User CPU / idle CPU | <1% / 21% | <1% / 61% |
| Combined physical ingress, packets/s | 1,298,671 | 1,296,518 |
| WAN receive / transmit, packets/s | 646,841 / 651,216 | 649,408 / 646,374 |
| WAN receive / transmit, Mbit/s | 3,788 / 3,816 | 3,803 / 3,716 |
| WAN mean receive bytes/packet | 732 | 732 |
| Ending PF state population | 4,570,096 | 4,617,974 |
| Median interval system + interrupt cost, core-ns / counted ingress packet | 9,678 | 4,707 |
| New LAN / WAN receive drops | 13,044 / 732 | 0 / 0 |
| Fast-forwarded share of counted IPv4 forwarding | 0% | >99% |
| Median matched after/before cost ratio | Reference | 0.487 (51% lower) |
| Matched-ratio middle half / full range | — | 0.485–0.490 / 0.475–0.492 |
2. What helped and what did not
Raising the state limit stopped allocation failures, but the router still stalled. Disabling unneeded pfsync and Hostwatch work cut CPU cost by 6.4% and 1.7% in separate tests. The timeout groups used fewer state-hours per new state, and the no-state rules stopped creating their own states; neither showed a whole-router CPU saving.
| Change | What happened | CPU result |
|---|---|---|
| State limit: 6,536,100 → 10,000,000 | PF memory counter: +159,726 over 255 s before; +0 over 362 s after | Allocation failures stopped; CPU stalls continued. No isolated CPU saving was measured. |
| State hash: 131,072 → 16,777,216 buckets | Verified after reboot; hash allocation was about 1,281 MiB | CPU benefit unknown: reboot and changing load prevented a clean comparison. |
| Pass logging and local Insight/NetFlow | Automatic pass logging removed; local services stopped | CPU effect was not measured separately. Kernel capture was already inactive. |
| pfsync, with no identified high-availability (HA) dependency | 6.4% lower matched system cost; 14 before/after comparisons | Reduced CPU cost at comparable load on the earlier kernel. |
| Hostwatch native disable | 1.7% lower matched system cost; 28 before/after comparisons | Reduced CPU cost at comparable load. |
| One-hour established-idle timeout | 10% fewer state-hours per new state in the pilot; 7% in replication | Less state retention per new state, but no measured CPU saving. |
| Scoped no-state TCP port 443 | Own-rule states and creations stayed zero; about 1% WAN ingress exposure | The selected rules stopped creating states; no whole-router CPU saving was demonstrated. |
3. CPU cost was still lower 12 days later
The first multi-hour averages were near 4,900 core-nanoseconds per received packet. Across the 12-day follow-up, the average was about 4,812.
Receive drops still occurred. During the 12-day follow-up, the counters recorded 109,298 LAN and 1,510,146 WAN receive drops—about 89 per minute combined—and 3 PF state-insert failures. Drops were also recorded before the VPN change and in later follow-ups. These observations do not establish a pre-flood normal rate.
| Averaging period / elapsed span | Receive drops, LAN / WAN | Busy CPU | CPU cost, core-ns / received packet | Physical ingress packets/s | WAN RX / TX Mbit/s |
|---|---|---|---|---|---|
| 3 h 56 min about +32 min → +4 h 28 min | 1,914 / 9,232 | 32% | 4,904 | 1,036,738 | 2,848 / 2,810 |
| 3 h 5 min about +4 h 28 min → +7 h 34 min | 2,058 / 6,550 | 33% | 4,871 | 1,076,429 | 2,991 / 2,941 |
| First 7 h 48 min 0 → about +7 h 48 min | 5,445 / 17,112 | ≈33% | ≈4,873 | ≈1,071,831 | ≈2,972 / 2,930 |
| 12 days 15 h 12-day follow-up from the post-benchmark start | 109,298 / 1,510,146 | ≈22% | ≈4,812 | ≈716,593 | ≈1,999 / 2,318 |
Technical notes
Design. Each same-boot phase supplied 31 snapshots and 30 valid 30-second intervals without counter resets. Kernel, state hash, offloads, interrupt moderation and relay trials stayed fixed; pfsync was down and Hostwatch disabled. Rules and WireGuard staging preceded the baseline. The treatment changed VPN transport/routing/policies without reboot or state flush. Post-sampling began about six minutes after intervention (five-minute minimum). An overlapping 20-second observer had unmeasured overhead.
Accounting. Pool kern.cp_time deltas across user, nice, system, interrupt and idle. Count physical LAN + WAN receive packets once per Link row, using actual read durations and skew checks; adding transmit double-counts transit.
f = (Δsystem + Δinterrupt) / ΔT
R = (ΔLAN RX packets + ΔWAN RX packets) / supported seconds
C = 10⁹ × 16 × f / R, in core-ns per counted physical ingress packet
The cost includes all system/interrupt work, not isolated forwarding time or useful delivery. Counted ingress excludes offered packets lost before accounting; PF states need not be unique connections.
Primary matching. Use d(a,b) = |a−b| / ((|a|+|b|)/2), zero for two zeros. Calipers: WAN RX packets/s 5%, TX packets/s 10%, RX bytes/packet 10%, endpoint-mean states 10%, insertions/s 25%. Rank by Σ(d/caliper); greedily select without reuse or CPU outcomes. Gates: ≥24 intervals/phase and ≥15 before/after comparisons. The estimator is median(C_after/C_before); serial spread is not a confidence interval. In timeout/no-state tests, matching on inventory/churn can condition away treatment effects.
Kernel path. With IPv4 forwarding enabled, ip_input attempts ip_tryforward if IPv4 IPsec support is disabled or its IPSEC_CAP_OPERABLE check returns zero. key_havesp_any() tests ordinary SPD count within the VNET, not packet selectors. Fast-forwarded is a subset of forwarded; PF route-to/reply-to can bypass these IP counters.
Collection. Ordinary reads had three-second deadlines and stopped on failure, identity mismatch or excessive lag, without retries. Boundary checks covered VPN/routes; monitored PF failures were memory, state-insert, state-limit and congestion. The benchmark used no tracing or state/socket dumps.
sysctl kern.boottime hw.ncpu kern.cp_time net.pf.states_hashsize kern.osrelease
netstat -ibdnW
pfctl -si
netstat -s -p ip
Cumulative spans. The first two spans had matching boot, configuration hashes and core-version metadata at their endpoints. Longer averages combine collectors and have approximate timing. They show continued low CPU cost, not a new matched VPN effect.
Encryption. WireGuard retained fixed ChaCha20-Poly1305, Curve25519 and Noise, plus a fresh random 256-bit preshared key. The experiment did not isolate cipher performance. Separate maintenance supplied the authentication-validation fix before deployment; use supported releases. Protocol · Security fix.