Page 1 of 1

backup iptables

Posted: Wed Nov 26, 2014 7:03 pm
by mister_v
Hi,

I would like to make a backup of my iptables rules.
Where is the iptables save-file?

Thanks,

Re: backup iptables

Posted: Wed Nov 26, 2014 7:15 pm
by Chris
The easiest way to make a backup is

Code: Select all

iptables-save > iptables.bak
The rules are now in iptables.bak

You can restore them with

Code: Select all

iptables-restore < iptables.bak
The standard save-file depends on your system.
check /etc/conf.d/iptables for where they are saved.
on my PC (gentoo) it is /var/lib/iptables/rules-save.
I believe on CentOS it is /etc/sysconfig/iptables.save.

Hope this helps.