I have an iptables rule. When searching for it with
sudo /sbin/iptables -L -n --line-numbers
I am getting it
Chain tcp_inbound (1 references)
num target prot opt source destination
xxxx
2 ACCEPT tcp -- 10.10.0.20 0.0.0.0/0 tcp dpt:25
xxxx
...
My goal is to delete this rule.
I tried with
sudo iptables -D INPUT 2
But the rule is still there. I am on debian. Any idea?
You're trying to delete rule 2 of chain
INPUT
, where your rule is stored in chaintcp_inbound
.The easiest way to find which rule to delete is to check the output of
iptables-save
, and change-A
to-D
is the rule you want to remove.In your case :
So you just need to issue :