Simple configuration of Linux firewall with insertion rules

  • 2020-05-14 05:48:57
  • OfStack

View the current firewall Settings


iptables -L INPUT -n --line-numbers 

Delete 1 policy, such as line 4 policy


iptables -D INPUT 4

-A: insert at the tail

-I (insert) inserts a new rule in the specified chain to indicate which line to insert

(e.g., insert at line 7)


iptables -I INPUT 7 -p tcp -m state --state NEW -m tcp --dport 81 -j ACCEPT

And then save


service iptables save

And then restart


service iptables restart

Related articles: