iptables - most easy way to find rule and remove it?

I have situation where I have rules in iptables with comments. Now... I can for example enter rule like "iptables -A FORWARD -s xxx -j ACCEPT" and delete it with "iptables -D FORWARD -s xxx -j ACCEPT".. but if that rule contain some random comment (-m comment) then ... ? I can find with scripting --line-numbers and remove line number, but there is race thing if something is inserted with "-I" meanwhile.... Anyone cares to suggest something?

See if this helps, you can edit the /etc/sysconfig/iptables file, vi the file and remove the rules you don't need.

Save the file and don't forget to do "service iptables restart" :).

this is slackware.. :slight_smile: no such file exists... and iptables cannot just be restarted :slight_smile: also it's not what I need.. I need to do it on-fly ... as this is for captive portal.