Iptables Remove Rules By Comment
Iptables Remove Rules By Comment. This tutorial will teach you how to list and delete iptables rules. For example I have rules with comment = "test it", so i can get list of them like this: sudo iptables -t nat -L
If you would like to remove the nat rule from the IPtables, just execute the command, # sudo iptables -F -t nat -v Flushing chain `PREROUTING' Flushing chain `INPUT' Flushing chain `OUTPUT' Flushing chain `POSTROUTING'.
On Ubuntu, one way to save iptables rules is to use the iptables-persistent package.
This firewall is based on chains that use rules to restrict or allow traffic to the machine. When we delete one rule, their numbers might change, so we must delete them by decreasing numbers, hence the sort -r. Otherwise you will see an error, Fatal: can't open lock file /run/xtables.lock: Permission denied.