Skip to content

Instantly share code, notes, and snippets.

@davidrapin
Last active August 29, 2015 14:14
Show Gist options
  • Save davidrapin/e96dfffc8021ed76676c to your computer and use it in GitHub Desktop.
Save davidrapin/e96dfffc8021ed76676c to your computer and use it in GitHub Desktop.
iptables cheat sheet
# show routing (with rule numbers per Chain fortable:"nat")
alias routing='sudo iptables -t nat -L -n -v --line-number'
# open 80 explicitly
# sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
# redirect 80 to 8080
# iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8080
# delete a rule (table:"nat", Chain:"OUTPUT" rule:1)
# sudo iptables -t nat -D OUTPUT 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment