Sunday, April 25, 2010

Activate iptables rules after reboot

List iptables rules:
iptables -L
Activate rules from file:
iptables-restore < iptables.rules
Save rules:
iptables-save > /etc/iptables.up.rules
These rules need to be restored when the network connection is going up.
touch /etc/network/if-pre-up.d/iptables
chmod +x /etc/network/if-pre-up.d/iptables
Add the following to /etc/network/if-pre-up.d/iptables:
#!/bin/sh
/sbin/iptables-restore < /etc/iptables.up.rules

No comments :

Post a Comment