Saturday, 23 January 2016
Insert an iptables rule before a specific line number with a comment, and restore all rules after reboot
# First get the iptables list with the line numbers enabled
$ iptables -nL --line-numbers
# Look up the line number you want to use (the exisitng rule will shift down) and insert your rule
$ iptables -I INPUT {LINE_NUMBER} -p tcp --dport 2121 -s 123.123.123.123 -j ACCEPT -m comment --comment "important information"
$service iptables save
$iptables -L -v
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment