Creating and restoring iptables backups

If you wish to try new iptables rules, temporarily disable them, or simply create a backup, you may use it's built in save function to save all current active rules.

Creating a backup:
This can be done via one simple command.

iptables-save > ~/iptables.bak

The location is arbitrary, and may be changed to your needs of course.

Restoring a backup:
If you wish to restore the rules you have created a backup for, the following command may be used.

cat ~/iptables.bak | iptables-restore

In the example, the location from the previous step was taken.

No Comments
Back to top