iptables: how to delete postrouting rule?

hiroo picture hiroo · Nov 23, 2011 · Viewed 75.1k times · Source

I would like to delete POSTROUTING rule below,

[root@hostname ~]# service iptables status
Table: nat
Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
num  target     prot opt source               destination         
1    MASQUERADE  all  --  192.168.1.0/24       0.0.0.0/0           

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         

then I typed below,

[root@hostname ~]# iptables -D POSTROUTING 1
iptables: No chain/target/match by that name

Is there anything wrong?

Answer

sarnold picture sarnold · Nov 23, 2011

Try adding the table name explicitly:

iptables -t nat -D POSTROUTING 1