To clear all rules in iptables I use this
#!/bin/bash echo "clearing iptables ... " sudo iptables -F sudo iptables -X sudo iptables -t nat -F sudo iptables -t nat -X sudo iptables -t mangle -F sudo iptables -t mangle -X sudo iptables -P INPUT ACCEPT sudo iptables -P FORWARD ACCEPT sudo iptables -P OUTPUT ACCEPT
This works so far as there are no entries in iptables any more, which is checked with
sudo iptables -L
sudo iptables -S
However, traffic that has been forwarded to a different target still is beeing routed to that target.
That seems like the cleared iptables still are active after clearing them!
Up to now my only way to get rid of those rules is to reboot the system which is not very elegant.
In Debian iptables doesn't seem to run as a service so start or stop of that service doesn't work.
How do I totally clear or reset iptables with the effect that previously defined rules are deactivated?