Reset iptables / Clear / Remove all iptables rules

iptables has many different tables. In order to reset it or remove all rules of it, you need to run a series of commands like below:

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -t raw -F
iptables -t raw -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

Don’t forget to save your iptables configuration. However, you have another option to do it easily and permanently by running the following command:

> /etc/sysconfig/iptables

And then restart the iptables service. All the rules will go away.