Skip to content

Instantly share code, notes, and snippets.

Created January 3, 2013 18:48
Show Gist options
  • Save anonymous/4445900 to your computer and use it in GitHub Desktop.
Save anonymous/4445900 to your computer and use it in GitHub Desktop.
iptables
iptables -P INPUT ACCEPT
iptables -F INPUT
iptables -F FORWARD
iptables -F OUTPUT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A INPUT -s 24.116.177.208/29 -i eth1 -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -o lo -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A FORWARD -o lo -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A FORWARD -o eth1 -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
ip6tables -P INPUT ACCEPT
ip6tables -F INPUT
ip6tables -F FORWARD
ip6tables -F OUTPUT
ip6tables -A INPUT -p icmp -j ACCEPT
ip6tables -A INPUT -i lo -j ACCEPT
ip6tables -A INPUT -i eth0 -j ACCEPT
ip6tables -P INPUT DROP
ip6tables -P FORWARD DROP
ip6tables -P OUTPUT ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment