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