Iptables rule on a specific line number

(Last Updated On: 09 May 2016)

Iptables is a firewall that plays an essential role in network security for most Linux systems. While many iptables tutorials will teach you how to create firewall rules to secure your server, this one will focus on a different aspect of firewall management: listing and deleting rules.

 

# First get the iptables list with the line numbers enabled

 

Look up the line number you want to use (the exisitng rule will shift down) and insert your rule

 

To delete a Rule with know its position in the chain.

 

Source

  1. stackoverflow
  2. digitalocean