In addition to the correct and helpful anwer of Olipro I would recommend something to
avoid the risk of being locked out by your firewall
Use a crontab-bound script which re-opens the firewall in case something went wrong; as you know you can make a mistake in your sshd_config whicht does not do real harm as long as you are still logged in. Not so with iptables: one mistake could be enough, and you are out. Therefor:
$IPT -P INPUT ACCEPT
$IPT -P FORWARD ACCEPT
$IPT -P OUTPUT ACCEPT
echo "FW opened on %h at $NOW" | mail -s "FW reset cron job jh1" \
logger "WARNING : iptables flushed and opened by cron job"
crontab -e place something like
#*/5 8-19 * * * /root/scripts/openFW.sh
to flush your iptables rules and open the FW every 5 mins.
Uncomment this before you edit your rules;
check the rules (be sure that they are available, and not already flushed by this cron job); after everything is fine comment the flush cron out
Hope this helps.