September 14, 2012

Delete IPTables Rules By Line Number

IPTables on some Linux distros add’s a load of random crap as default. We had a server that would die if you flushed it so I had to find out a way of removing by chain number instead.

First off list all IPTable’s rules by chain number:

iptables -vnL --line-numbers

Then delete the line you want:

iptables -D INPUT 22

This will delete chain line number 22

Leave a Reply

Your email address will not be published. Required fields are marked *