Skip to content

Instantly share code, notes, and snippets.

@ericsaboia
Last active August 29, 2015 14:04
Show Gist options
  • Save ericsaboia/aa3d863591dff54a45dc to your computer and use it in GitHub Desktop.
Save ericsaboia/aa3d863591dff54a45dc to your computer and use it in GitHub Desktop.
iptables.sh
sudo iptables -F
sudo iptables -X
sudo iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -p icmp -j ACCEPT # allow ping
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT # allow SSH
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT # allow HTTP
sudo iptables -I INPUT -i lo -j ACCEPT # allow local
sudo iptables -A INPUT -j DROP # drop everything else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment