Howto: Reset iptables firewall

Recently, one of the customer trying to make some changes from the iptables and ended up the server couldn’t access through SSH.

In order to get it done, I have consider to reset the iptables firewall rules with the following command.

# iptables -P INPUT ACCEPT
# iptables -F
# iptables -A INPUT -i lo -j ACCEPT
# iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
# iptables -A INPUT -p tcp –dport 22 -j ACCEPT
# iptables -P INPUT DROP
# iptables -P FORWARD DROP
# iptables -P OUTPUT ACCEPT
# iptables -L -v

Published by

Mick Genie

Mick Genie is the founder of and working at ExaBytes Network Sdn Bhd and WPWebHost web host company. He is expertise in Windows and Linux environment especially web hosting related information, tips and trick as well as the IT Information.

One thought on “Howto: Reset iptables firewall”

  1. You can reset the iptabels rules by copying the configuration file came up with the package in your distro. That will be the best way to restore to factory defaults.

Comments are closed.