Easy way to delete rule from iptables

Valic —  January 28, 2012 — 1 Comment
You can view iptables entries by line with command:
iptables -L INPUT -n --line-numbers

[email protected]:~# iptables -L INPUT -n –line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     tcp  –         tcp dpt:22
2   ACCEPT     tcp  –         tcp dpt:80
3    ACCEPT     tcp  –         tcp dpt:443
4    ACCEPT     tcp  –         tcp dpt:21
5   ACCEPT     all  –  
6   ACCEPT     all  –
7   ACCEPT     icmp –  
8   ACCEPT     all  –
9   DROP       all  –             state NE

You’ll get the list of all INPUT entries.  Look at the number on the left  then use the following command to delete :

iptables -D INPUT <<number here>>



Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

One response to Easy way to delete rule from iptables

  1. Wiley Mihelich January 28, 2012 at 22:43

    Your writing is great:)

Leave a Reply