Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have what appears to be weird and convoluted set of rules which work for me at the moment. Is there a way of "exporting" those and saving them to a file so that they can be restored later on in case things are messed up?

share|improve this question
up vote 17 down vote accepted

With suitable privilege

iptables-save >/some/file

will save your iptables configuration to /some/file


iptables-restore </some/file

will restore your saved configuration from /some/file

share|improve this answer
Ah... I didnt know of those. I kept looking for some command line options! – siliconpi Sep 23 '10 at 0:43
Awesome ! Thanks !! – AlvaroAV Jan 5 '15 at 10:20

This should do the trick. It writes your rules to /etc/sysconfig/iptables; if you (re)start iptables after you do this, your rules should be there :)

/sbin/service iptables save
share|improve this answer

Don't you have iptables-save and iptables-restore commands ?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.