Technology Blog

How to Flush a firewall with default drop rules

by on Nov.18, 2010, under Uncategorized

Flush Iptables
So some of our firewall’s have a default policy of dropping any packets which are not allowed for. This causes a problem when you flush the whole firewall, as now you have zero allow rules and a default policy of drop. That’s right, it means you’ve just locked yourself out of the server!

I always forget how to flush a firewall safely with defualt policy of drop. I know you have to set it to accept, put always forget that the switch is -P. The below will work for setting the default policy of the three main chains and flushing the firewall:


/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables -F


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...