Debian: Save current active iptables rules


some basic commands to handle a ruleset of iptables.

To dump all active iptables rules to the console rules use

root@debdev:~ # iptables-save

If you want to load these rules on demand, save all rules in file of your home

root@debdev:~ # iptables-save > ~/firewall.rules

To reload all rules on demand use the following command

root@debdev:~ # iptables-restore

If your rules should survive a system restart, install the package iptables-persistent and write the output of the save command to a file /etc/iptables/rules.v4

root@debdev:~ # apt-get install iptables-persistent
root@debdev:~ # iptables-save > /etc/iptables/rules.v4


Advertisment to support

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.