• Linux
  • FreeBSD
  • Networking
  • Python
  • AWS
  • WebDev
  • About Us

How to list and delete an IPtables rule in Linux

Written by
Linux Leave a Comment

We will first check some of the general Iptables commands . The below command will dispaly all the available chains ( TCP, INPUT, OUTPUT, etc.) configured.

iptables -S

You can then filter this more with specific chains , the below command will display all the INPUT rules

iptables -S INPUT

To display all the active rules , you can do the same chain filtering with this command .

iptables -L

so to delete a rule ,first you need to find the line number of your rule.

 iptables -L INPUT --line-numbers

This will display all the INPUT rules and its corresponding line number. For eg : to delete rule number 58 , the command will be :

iptables -v -D INPUT 58

This will delete the INPUT chain rule 58 and then you need to save the changes

service iptables save

© Copyright 2020.TechieNix. All Rights Reserved.