26

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?

siliconpi
  • 1,807
  • 6
  • 32
  • 46

3 Answers3

43

With suitable privilege

iptables-save > /some/file

will save your iptables configuration to /some/file

and

iptables-restore < /some/file

will restore your saved configuration from /some/file.

Pablo A
  • 177
  • 1
  • 9
user9517
  • 115,471
  • 20
  • 215
  • 297
3

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
wzzrd
  • 10,409
  • 2
  • 35
  • 47
1

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

ixio
  • 53
  • 7