Linux – disable or reset iptables / firewall

Linux – disable or reset iptables / firewall

Have you ever locked yourself out with a firewall rule? It can happen…but fortunately the settings can be quickly reset using a KVM console, for example.

Resetting the iptables to “default” would be possible with the following commands:

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

The last 3 commands allow just about any traffic (inbound, outbound, forward).

Leave a Reply

Your email address will not be published. Required fields are marked *