Setup autosave of iptables rules and reload on reboot, Debian

Discussion in 'Server Operation' started by PermaNoob, Mar 23, 2012.

  1. PermaNoob

    PermaNoob Member

    Here's what I did--I would appreciate someone checking to see if I got it right.

    I'm working in winscp, which I use for editing, changing permissions, etc. except editing the crontab file.


    Save the iptables rules:

    iptables-save > /etc/firewall.conf

    Create a new file which will be executed on reboot:


    Add the line:

    /sbin/iptables-restore < /etc/firewall.conf

    Save the file /etc/network/if-pre-up.d/iptables and make it executable.

    I want the iptables rules saved every hour:

    Edit the crontab:

    crontab -e

    add the line:

    01 * * * * /sbin/iptables-save > /etc/firewall.conf

    save ("write out" in nano) the crontab file and exit nano.


    Is that going to work ok?
    Last edited: Mar 23, 2012
  2. falko

    falko Super Moderator ISPConfig Developer

    I think so, but if you are unsure, test it on a test machine first.

Share This Page