Skip to content

Instantly share code, notes, and snippets.

@ekiara
Last active August 29, 2015 13:59
Show Gist options
  • Save ekiara/10605283 to your computer and use it in GitHub Desktop.
Save ekiara/10605283 to your computer and use it in GitHub Desktop.
iptables snippet
## iptables snippet ##
# Get current iptables list with line numbers
/usr/bin/sudo /sbin/iptables --line-numbers -L
# Add a rule to the INPUT chain, append it to the end
/usr/bin/sudo /sbin/iptables -A INPUT -p tcp --dport 12345 -j ACCEPT
# Insert a rule to the INPUT chain, before the line number 7
/usr/bin/sudo /sbin/iptables -I INPUT 7 -p tcp --dport 12345 -j ACCEPT
# Delete the rule at line number 13, in the INPUT chain
/usr/bin/sudo /sbin/iptables -D INPUT 13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment