Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: IPTables rules weg na reboot  (gelezen 914 keer)

Offline Lakitna

  • Lid
IPTables rules weg na reboot
« Gepost op: 2010/01/17, 16:27:36 »
Mensen,

sindskort heb ik IPTables draaien op mijn server maar na een reboot zijn al mijn regels die ik heb toegevoegd weg. Ik heb deze handmatig toegevoegd in een config file "iptables.rules", aanwezig in /etc/.

Ik heb in /etc/network/interfaces de regel "pre-up iptables-restore < /etc/iptables.rules" gezet maar na een reboot heb ik alsnog geen IP meer en is mijn eth0 interface niet meer aanwezig in de config file 'interfaces'. Zie ik iets over het hoofd of..?

Gr Lakitna
« Laatst bewerkt op: 2010/01/17, 16:33:26 door Lakitna »

Offline ivo

  • Lid
Re: IPTables rules weg na reboot
« Reactie #1 Gepost op: 2010/01/17, 20:56:02 »
Ik heb er geen ervaring mee, maar voor mijn gevoel moet je jouw "iptables.rules"
in de directory /etc/network/if-up.d neerzetten uiteraard uitvoerbaar middels een chmod 755
op het bestand.

There are only 10 types of people in the world; those who understand binary and those who don't.

Offline Lakitna

  • Lid
Re: IPTables rules weg na reboot
« Reactie #2 Gepost op: 2010/01/18, 10:31:39 »
Ik heb er geen ervaring mee, maar voor mijn gevoel moet je jouw "iptables.rules"
in de directory /etc/network/if-up.d neerzetten uiteraard uitvoerbaar middels een chmod 755
op het bestand.


Dit heeft niet geholpen, iemand nog ideeen?

Offline ivo

  • Lid
Re: IPTables rules weg na reboot
« Reactie #3 Gepost op: 2010/01/18, 11:41:54 »
http://www.howtoforge.com/linux_iptables_sarge

Citaat:

The Debian Way
The old style init script is no longer in Sarge by default, but it is still around for legacy use. I believe the new way is to use ' /etc/network/if-up.d' and '/etc/network/if-down.d' for iptables scripts (but I don't like that).

En:

https://help.ubuntu.com/community/IptablesHowTo#Configuration on startup

Alternatively you could add the iptables-restore and iptables-save to the if-pre-up.d and if-post-down.d directories in the /etc/network directory instead of modifying /etc/network/interface directly.

The script /etc/network/if-pre-up.d/iptaload will contain:


#!/bin/sh
iptables-restore < /etc/iptables.rules
exit 0
and/etc/network/if-post-down.d/iptasave will contain:


#!/bin/sh
if [ -f /etc/iptables.downrules ]; then
   iptables-restore < /etc/iptables.downrules
fi
iptables-save -c > /etc/iptables.save
exit 0
Then be sure to give both scripts execute permissions:

# chmod +x /etc/network/if-post-down.d/iptasave
# chmod +x /etc/network/if-pre-up.d/iptaload
« Laatst bewerkt op: 2010/01/18, 11:52:43 door ivo »
There are only 10 types of people in the world; those who understand binary and those who don't.