Configuring iptables for start-up in debian

From Notes_Wiki
Revision as of 01:18, 3 January 2013 by Saurabh (talk | contribs) (Created page with "<yambe:breadcrumb>Debian|Debian</yambe:breadcrumb> =Configuring iptables for start-up in debian= Most probably there is no default iptables configuration file such as '<tt>/e...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<yambe:breadcrumb>Debian|Debian</yambe:breadcrumb>

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