iptables won't restore on reboot ?

This is my /etc/network/interfaces (sans IPs):

auto lo
iface lo inet loopback

auto eth0

iface eth0 inet static
 address ...
 netmask ...
 gateway ...
 pre-up iptables-restore < /etc/iptables.saved

Didn't want to paste my iptables.saved, but suffice it to say that if I run iptables-restore < /etc/iptables.saved manually at any point after reboot, it restores the correct rules.

Asked Linode for help, they referred me to forums :/

4 Replies

What if you replace "pre-up" with up/post-up? Perhaps your rules have some interface-specific parameters that won't work if your interface is still down?

– David

@db3l:

What if you replace "pre-up" with up/post-up? Perhaps your rules have some interface-specific parameters that won't work if your interface is still down?

– David

Ooh, I like where you're going w/ this, will try it (can't reboot production box, though). Is there a set of rules I should look for off the top of your head ?

And is there a difference between up and (EDIT) post-up ?

@romy:

Ooh, I like where you're going w/ this, will try it (can't reboot production box, though). Is there a set of rules I should look for off the top of your head ?
Look for "-i " in the rules, for example.

> And is there a difference between up and (EDIT) post-up ?
I think they're synonymous.

In terms of testing, you could always spin up a test Linode just long enough to test. Copy over your iptables save file from the production box and do a few tests on it. You could also try installing the rules while on the console with eth0 still down.

– David

Yup, definitely had a bunch of -i rules in the file. I'll give it a test soon.

Thanks!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct