Skip to content

Instantly share code, notes, and snippets.

@ppdeassis
Last active December 18, 2015 05:59
Show Gist options
  • Save ppdeassis/5736379 to your computer and use it in GitHub Desktop.
Save ppdeassis/5736379 to your computer and use it in GitHub Desktop.
Manipulating rules with iptables
# listing chain rules
iptables --list CHAIN --line-numbers
# deleting a rule
iptables --delete CHAIN LINE_NUMBER
# inserting a rule in a predefined position (i.e. 3)
iptables -I INPUT 2 -p tcp --dport 80 -j ACCEPT
# appending rule to chain
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
# saving rule modifications
service iptables save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment