PDA

View Full Version : How can I save iptables rules on Debian/Ubuntu?


Artyom
08-02-2009, 10:07 PM
After you add the rules and issue the 'iptables-save' command, you want those rules to remain there after a reboot. This is a bit trickier to do than on a RH based system. Here is one way:

1. Save your iptables to a file using the following command:
iptables-save > /etc/iptables.conf

2. Then edit the /etc/network/interfaces file by adding the following line right after 'iface eth0 inet static':

pre-up iptables-restore < /etc/iptables.conf

That should do it!

Artyom
10-04-2010, 07:56 PM
This is also how you change the firewall rule on Debian, essentially restarting the firewall.

A good how-to is also located here: http://wiki.debian.org/iptables