Skip to content

Instantly share code, notes, and snippets.

@alexbosworth
Created January 25, 2019 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexbosworth/d5558c1d89651daf98a62910a8484dcc to your computer and use it in GitHub Desktop.
Save alexbosworth/d5558c1d89651daf98a62910a8484dcc to your computer and use it in GitHub Desktop.

Setup iptables

Limit the number of incoming TCP connections

sudo iptables -N syn_flood
sudo iptables -A INPUT -p tcp --syn -j syn_flood
sudo iptables -A syn_flood -m limit --limit 1/s --limit-burst 3 -j RETURN
sudo iptables -A syn_flood -j DROP
sudo iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j ACCEPT
sudo iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j LOG --log-prefix PING-DROP:
sudo iptables -A INPUT -p icmp -j DROP
sudo iptables -A OUTPUT -p icmp -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment