As a quick note to self, here’s how I configured the firewall rules on a new CentOS 6 Linux server recently.
First, I created an “undo” script at /root/undo-iptables with these contents:
echo "running UNDO at `date`" > $OUT
unalias mv >> $OUT 2>&1
mv /etc/sysconfig/iptables /tmp >> $OUT 2>&1
/etc/init.d/iptables restart >> $OUT 2>&1
I then made that file executable.