From Notes Wiki
Jump to: navigation, search
Home > Debian > Configuring iptables for start-up in debian

Configuring iptables for start-up in debian

Most probably there is no default iptables configuration file such as '/etc/sysconfig/iptables' of Cent-OS in debian. Hence to enable iptables on start-up a iptables configuration file can be created in /etc and then start-up configuration is done to restore the iptables configuration at start-up.

Steps for configuring start-up iptables on debian are:

  1. iptables-save > /etc/iptables.up.rules
  2. Edit '/etc/iptables.up.rules' and configure appropriate rules
  3. Test with 'iptables-restore < /etc/iptables.up.rules'
  4. Create '/etc/network/if-pre-up.d/iptables' with following contents:
    #!/bin/bash
    /sbin/iptables-restore < /etc/iptables.up.rules
    (Remove space from first column in both lines)
  5. chmod +x /etc/network/if-pre-up.d/iptables


Steps learned from http://wiki.debian.org/iptables