Skip to content

Instantly share code, notes, and snippets.

@ottomata
Created July 20, 2012 18:47
Show Gist options
  • Save ottomata/3152516 to your computer and use it in GitHub Desktop.
Save ottomata/3152516 to your computer and use it in GitHub Desktop.
iptables
# deny all incoming traffic, but allow outgoing
iptables -P OUTPUT ACCEPT
iptables -P INPUT DROP
# allow ping
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
# allow loopback
iptables -A INPUT -i lo -j ACCEPT
# allow any incoming established traffic
iptables -A INPUT -i eth0 -m state --state ESTABLISHED -j ACCEPT
# allow any incoming traffic from 10.64.21.0/24
iptables -A INPUT -i eth0 -s 10.64.21.0/24 -m state --state NEW,ESTABLISHED -j ACCEPT
# allow any incoming traffic on port 8085 (apache http proxy w http auth)
iptables -A INPUT -i eth0 -p tcp --dport 8085 -m state --state NEW,ESTABLISHED -j ACCEPT
# allow any incoming traffic on ssh port 22
iptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment