backup iptables

Post Reply
mister_v
Posts: 137
Joined: Sat Jun 20, 2009 5:42 pm

backup iptables

Post by mister_v »

Hi,

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

Thanks,
Chris
Site Admin
Posts: 127
Joined: Mon Jul 21, 2008 9:45 am
Location: Leuven, Belgium
Contact:

Re: backup iptables

Post 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.
Post Reply