Restore Iptables Secara Otomatis saat Booting
Ada script untuk ini via file init.d, akan tetapi ada alternatif lain yg bisa digunakan yaitu via script networking ifup.d dimana akan di eksekusi saat ada perubahan status network interfaces.
Buat file “iptables” di direktori /etc/network/if-pre-up.d
#!/bin/sh
RESTORE=/sbin/iptables-restore
STAT=/usr/bin/stat
IPSTATE=/etc/iptables.conftest -x $RESTORE || exit 0
test -x $STAT || exit 0if test `$STAT –format=”%a” $IPSTATE` -ne “600″; then
echo “Permissions for $IPSTATE must be 600 (rw——-)”
exit 0
fiif test `$STAT –format=”%u” $IPSTATE` -ne “0″; then
echo “The superuser must have ownership for $IPSTATE (uid 0)”
exit 0
fi$RESTORE < $IPSTATE
Kemudian pastikan script tersebut bisa di eksekusi
# chmod +x iptables
# chown root:root iptables
Script ini akan me-load seting dari $IPSTATE – defaultnya /etc/iptables.conf.
Menyimpan rule iptables :
# iptables-save > /etc/iptables.conf




