Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iptables: how to delete postrouting rule? [closed]

Tags:

iptables

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?

like image 913
hiroo Avatar asked Nov 23 '11 08:11

hiroo


People also ask

Which iptables option allows you to delete a rule?

-D — Deletes a rule in a particular chain by number (such as 5 for the fifth rule in a chain). You can also type the entire rule, and iptables deletes the rule in the chain that matches it.

What is Postrouting iptables?

The nat table in iptables adds two new chains. PREROUTING allows altering of packets before they reach the INPUT chain. POSTROUTING allows altering packets after they exit the OUTPUT chain.


1 Answers

Try adding the table name explicitly:

iptables -t nat -D POSTROUTING 1 
like image 155
sarnold Avatar answered Sep 20 '22 06:09

sarnold