Ubuntu 12.04 – How to Reset Iptables to Default Without Locking Out

iptablesubuntu-12.04

Could anyone kindly provide the commands to completely reset the iptables (firewall) for Ubuntu 12.04 to its default "factory" setting? From what I understand, doing this wrong would cause one to be locked out of the linux box?

Best Answer

Set the default policy on the iptables to ACCEPT:

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

Then flush the rules:

iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD

Note, this will not affect alternate tables, NAT tables, PRE/POST routing tables, etc.

Related Topic