Announcement

Collapse
No announcement yet.

Loading iptables rules using /etc/network/if-pre-up.d

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Loading iptables rules using /etc/network/if-pre-up.d

    I'm probably missing the simplest of things, but my iptables rules file is not being loaded on (Kubunto 10.10) system startup. This is what I have:
    • a "myfirewall.rules file" generated using iptables-save. This file has been tested using iptables-restore and works.
    • In the "/etc/network/if-pre-up.d" folder, I have a bash script called "set-iptables-rules.sh" which performs iptables-restore with my rules file. This script has been tested and works.


    However, when I reboot my system, I still get the vanilla iptables rules being loaded. Any ideas what am I missing? Does my file in the "if-pre-up.d" folder need to have a particular name or extension to be loaded? If not, how does my system know to load my file, or does it just run all files it find in the folder? I would prefer not to modify my "/etc/network/interfaces" file if I don't have to (and from my research, I get the impression the "interfaces" method is an alternative method to using the "if-pre-up.d" method?).

    Thanks

    #2
    Re: Loading iptables rules using /etc/network/if-pre-up.d

    To confuse myself even more, I've just found a third method on a Debian forum which doesn't use the if-pre-up.d folder at all (http://forums.debian.net/viewtopic.php?f=5&t=45741):

    Create a symlink to my script in /etc/rcS.d named "S01fwinit". Modify my script to include header information which lets the system determine in what order to run the script.

    So now I'm thinking whether I need to bother with "if-pre-up.d" at all?

    Comment


      #3
      Re: Loading iptables rules using /etc/network/if-pre-up.d

      Maybe my bash script needs to be a sh script?

      Comment


        #4
        Re: Loading iptables rules using /etc/network/if-pre-up.d

        While digging around in the filesystem, I came to realise that Kubuntu 10.10 installs ufw by default. When I then looked into the ufw configuration, it is set to disabled on system startup, which by default results in iptables rules that ACCEPT on the built in INPUT, OUTPUT and FORWARD chains. This explains the rules I am seeing when I do "iptables -L" after system startup.

        After changing the ufw configuration file to enabled on system startup, I now see a more complex set of iptables rules that I need to check to see if it meets my needs.

        Much time spent, but at least I understand what is going on :-)

        Comment


          #5
          Re: Loading iptables rules using /etc/network/if-pre-up.d

          I guess I missed it, but what is the purpose of this iptables setup?

          Comment

          Working...
          X