How to RESET/FLUSH/DELETE all iptables in Linux

Take backup

iptables-save > ~/iptables-`date +%Y%m%d_%H%M%S`.bak

Flush now

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

Again to restore from backup

iptables-restore < bak.file

Comments

Leave a Reply

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