How to clear all iptables rules

You can completely flush all iptables rules by running the commands that we present below:

1. iptables -F
2. iptables – X
3. iptables -t nat -F
4. iptables -t nat -X
5. iptables -t mangle -F
6. iptables -t mangle -X
7. iptables -t raw -F
8. iptables -t raw -X
9. iptables -P INPUT ACCEPT
10. iptables -P FORWARD ACCEPT
11. iptables -P OUTPUT ACCEPT

If your default policy is set to DROP be sure to change the INPUT FORWARD and OUTPUT policy running the -F command or you will be locked.

Leave a Reply