Free Tool
iptables DDoS Protection Rule Generator
Generate battle-tested iptables rules for Linux DDoS mitigation. Select the protections you need, customize rate limits, and get ready-to-use rules with detailed comments.
iptables-restore with a cron job to auto-revert rules after 5 minutes during testing.
What These Rules Do
SYN Flood Protection
Limits the rate of new TCP connection attempts (SYN packets) per source IP. SYN floods exhaust server connection tables by sending thousands of half-open connections. The hashlimit module tracks per-IP rates efficiently.
UDP Flood Protection
Rate limits UDP packets per source IP. UDP floods are stateless and can easily saturate bandwidth. Common in amplification attacks (DNS, NTP, memcached). These rules limit the packet rate from any single source.
ICMP Rate Limiting
Restricts ICMP (ping) packets to a reasonable rate. Prevents ping floods while still allowing legitimate network diagnostics. Smurf attacks use ICMP amplification to overwhelm targets.
Connection Limiting
Caps the number of simultaneous connections from a single IP address. Prevents resource exhaustion from slowloris-style attacks or botnets opening many connections from each host.
Invalid Packet Dropping
Drops packets with invalid TCP flag combinations (XMAS, NULL scans) and packets that don't match any known connection state. These are commonly used in reconnaissance and evasion attempts.
Port Scan Protection
Detects hosts that probe multiple ports in a short time window and temporarily blocks them. Attackers scan for open ports before launching targeted attacks.
Bogon Filtering
Blocks traffic from IP ranges that should never appear on the public internet (RFC 1918 private ranges, loopback, etc.). Spoofed source IPs from these ranges indicate malicious traffic.
Best Practices
Always enable connection tracking (conntrack), accept established connections first for performance, and log dropped packets to detect attacks early. Use Flowtriq for real-time monitoring.
Protect your infrastructure with Flowtriq
Detect DDoS attacks in under 1 second. Classify attack types automatically. Get instant alerts.
Start your free trial →