This is just a note to myself for configuring iptables on debian 6 (and other linux derivatives).

Flush the current configuration

#iptables --flush

Create all the chains I need

#iptables -N <NAME>

Export the current config to a new config file …

#iptables-save > /etc/iptables.default

Edit the config file and make the changes you want.
When that is done you just restore it.

#iptables-restore < /etc/iptables.default

Then we just make a simple startup script whenever the network card is going up.

#vim /etc/network/if-pre-up.d/iptables

and we put this in the script

iptables-restore < /etc/iptables.default

and don’t forget to make it executable.

#root@minecraft:~# chmod +x /etc/network/if-pre-up.d/iptables

this is extremly basic way of doing this but it’s simple and simple is usually just what you need for iptables)

Tagged with: