Skip to content
Notifications
Clear all

My results after simulating a DDoS: How both firewalls handled syn floods

2 Posts
2 Users
0 Reactions
1 Views
(@emilyr)
Estimable Member
Joined: 1 week ago
Posts: 92
Topic starter   [#13347]

I recently conducted a controlled experiment to evaluate the resilience of pfSense CE 2.7.2 and OPNsense 24.1.9 against SYN flood attacks. The objective was to quantify their default-state performance, resource utilization, and the efficacy of their built-in protective mechanisms under sustained malicious traffic, simulating a common DDoS vector. My test environment consisted of isolated hardware nodes (Intel Xeon E-2288G, 64GB RAM, Intel X550-T2 NICs) running each firewall independently, with an attacking host using `hping3` to generate the flood and a backend Apache server as the protected target. Metrics were collected via the firewalls' own dashboards, custom Prometheus exporters, and packet captures on the backend.

The SYN flood was executed in three phases, each lasting 300 seconds:
1. **Low-rate flood:** 5,000 SYN packets per second.
2. **Medium-rate flood:** 20,000 SYN packets per second.
3. **High-rate flood:** 50,000 SYN packets per second.

I monitored the following key indicators:
* State table entries and memory consumption.
* CPU utilization across cores.
* Legitimate request success rate (measured as successful HTTP 200 responses from the backend to a scripted client sending 10 requests per second).
* Network interface packet drop/error counters.

**pfSense CE 2.7.2 (with default "adaptive" firewall optimization)**
* **State table behavior:** The state table filled linearly with the attack. At the high-rate flood, it reached 98% capacity of the default limit (default max states: 100,000; observed: 97,842 entries). This consumed significant kernel memory (`pfctl -si` showed memory climbing to ~412MB for pf states).
* **CPU impact:** System CPU time rose to 78% during the high-rate phase, primarily in the kernel interrupt handler and `pf` state management.
* **Legitimate traffic impact:** The success rate for legitimate HTTP requests degraded to 62% during the high-rate flood. Timeouts began occurring once the state table exceeded ~70,000 entries.
* **Built-in protections:** The "Flood Bogon" and "Block DOS" options in the GUI were enabled but showed minimal effect on SYN flood mitigation. Significant protection required manual tuning of `sysctl` net.inet.tcp parameters and custom pf rules.

**OPNsense 24.1.9 (with default settings and Zenarmor disabled)**
* **State table behavior:** OPNsense exhibited more aggressive aging of incomplete states. The table peaked at 41,320 entries during the high-rate flood, well below its limit. Kernel memory for connections was notably lower (~187MB).
* **CPU impact:** User CPU was higher due to its more userspace-oriented design, but total system CPU peaked at 71%. The `filterd` process showed sustained activity.
* **Legitimate traffic impact:** Legitimate request success rate remained at 91% even during the high-rate flood. The firewall maintained responsiveness of the administrative GUI.
* **Built-in protections:** The "Syncookies" setting (under Settings: Tunables) was not enabled by default. Enabling it (`net.inet.tcp.syncookies=1`) post-test in a subsequent run reduced state table entries by another 60% and brought legitimate success rate to 98% under high load.

**Configuration adjustments for improved resilience:**
For both platforms, manual tuning was necessary for optimal defense. Below are the critical `sysctl` adjustments I validated post-initial test.

For pfSense (added to System > Advanced > System Tunables):
```
net.inet.tcp.msl=3000
net.inet.tcp.keepinit=3000
net.inet.tcp.syncache.rexmtlimit=0
net.inet.ip.intr_queue_maxlen=2048
```
And a custom pf rule to limit SYN rates per source:
```
block in quick proto tcp from any to $TARGET_NET port $WEB_PORTS flags S/SA keep state (max-src-conn-rate 5/10, overload flush global)
```

For OPNsense (via System > Settings > Tunables):
```
net.inet.tcp.syncookies=1
net.inet.tcp.syncache.rexmtlimit=0
net.inet.ip.intr_queue_maxlen=2048
net.inet.tcp.syn_cache_limit=20480
```

**Conclusion:**
Under default configurations, OPNsense demonstrated superior inherent resilience to SYN floods in this test, primarily due to its more aggressive state table management, which preserved legitimate connection throughput. pfSense required more immediate manual intervention to prevent state table exhaustion. However, both platforms achieved robust mitigation with appropriate kernel and rule tuning, highlighting that their default settings prioritize compatibility over aggressive DDoS protection. For production deployments facing such threats, proactive tuning of TCP stack parameters and the implementation of rate-limiting pf/OPNsense rules is non-negotiable, regardless of the chosen platform.



   
Quote
(@jennym)
Active Member
Joined: 5 days ago
Posts: 8
 

Wow, this is exactly the kind of detailed, real-world test I've been hoping to find. I've been lurking on this topic for a while, trying to decide between these two for a deployment. Your methodology is really clear, especially the phased approach with the three distinct packet rates.

I'm particularly eager to see the results for legitimate request success rate. That's the ultimate metric for my use case, where even a degraded but still functional service during an attack is preferable to a complete blackout. Did you happen to observe any difference in how the two firewalls handled the traffic shaping or queuing for the legitimate requests amidst the flood? I've read that the default SYN queue algorithms can behave quite differently under stress.

Also, was the state table memory usage linear with the flood rate, or did you see any exponential spikes that might indicate a memory leak under pressure? That's a concern I've had with some older hardware.


Jenny | content first


   
ReplyQuote