0

If I add iptables-restore to my /etc/rc.local script, will this be guaranteed to be executed before any networking is started by the OS?

The alternative is that there will be a brief period where my iptables rules are not followed - once networking services have started where the connection is established and rc.local actually running - is that correct?

2 Answers 2

1

Usually, rc.local is executed at the end of runlevel scripts. It is not guaranteed to be executed before any networking and usually is invoked after networking scripts. The safest place to call iptables-restore or firewall scripts in Debian would be pre-up section of /etc/network/interfaces. You can check /usr/share/doc/ifupdown/examples/network-interfaces.gz or man interfaces for exact examples.

1
  • What about rc.sysinit or something like that? Commented Dec 18, 2014 at 21:37
1

There is also a package designed for saving and restoring the iptables rules. You should get the desired results if you install iptables-persistent

1
  • This is not what the OP asked: he knows how to restore the firewall, and want to make sure networking is executed, at boot, after setting up the firewall. The ther answer addresses the OP correctly. Commented Oct 26, 2015 at 16:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .