Удаление правил iptables по их номерам

Смотрим список правил с номерами.

 iptables -L -t nat --line-numbers

Видим примерно следущее

 Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination
1  DNAT       udp  --  anywhere             proxy               udp dpt:475 to:192.168.100.6:475
2 DNAT       tcp  --  anywhere             proxy               tcp dpt:3389 to:192.168.100.202:3389
3 DNAT       tcp  --  anywhere             anywhere            tcp dpt:www to:192.168.100.192:3128

Chain POSTROUTING (policy ACCEPT)
num  target     prot opt source               destination
1 MASQUERADE  all  --  192.168.0.0/16       anywhere
2 SNAT       tcp  --  anywhere             192.168.100.202     tcp dpt:3389 to:91.196.161.26

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

Чтобы удалить нужное правило нужной цепочки -  Указываем цепочку и номер правила.

iptables -t nat -D PREROUTING 3

Вроде всё :)

Оставить комментарий


Примечание - Вы можете использовать эти HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>