DANGEROUS
While working on iptables, if you get confused about policies and you need to start afresh then you need to reset iptables to default settings. By default, I mean to set accept all policy and flush any existing configured rules from settings.
In this article, we will walk through a set of commands to reset iptables to default settings. This can also be treated as how to reset firewall in Linux like ubuntu, centos, Redhat, Debian, etc. Itโs a pretty simple 2 steps process.
Step 1 : Set accept all policy to all connections
Using the below set of commands you will set accept rule for all types of connections.
root@kerneltalks # iptables -P INPUT ACCEPT
root@kerneltalks # iptables -P OUTPUT ACCEPT
root@kerneltalks # iptables -P FORWARD ACCEPT
This will confirm, iptables gonna accept all requests for all types of connections.
Step 2 : Delete all existing rules.
Using below set of commands, delete your currently configured rules from iptables.
root@kerneltalks # iptables -F INPUT
root@kerneltalks # iptables -F OUTPUT
root@kerneltalks # iptables -F FORWARD
Or you can do it in single command โ
root@kerneltalks # iptables -F
Thatโs it! Your iptables are reset to default settings i.e. accept all! Now, neatly and carefully design your policies and configure them.