WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Settings for iptables does not persist  (Read 6388 times)

Offline Holmes.Sherlock

  • Newbie
  • *
  • Posts: 25
    • Team Reboot
Settings for iptables does not persist
« on: May 21, 2012, 01:24:48 AM »
I have installed iptables on the Core platform & have set up persistence successfully. But, I can't find where iptables specific settings are stored. So, all the rules I am adding are getting flushed on next reboot. Please help.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: Settings for iptables does not persist
« Reply #1 on: May 21, 2012, 01:39:10 AM »
You can do something like this:
Code: [Select]
$ touch mymarker
[do whatever causes the settings to be stored]
$ sudo find / -not -type 'd' -cnewer mymarker | grep -v "\/proc\/" | grep -v "^\/sys\/" | tee files
$ vi files

This probably requires the findutils extension

Offline Holmes.Sherlock

  • Newbie
  • *
  • Posts: 25
    • Team Reboot
Re: Settings for iptables does not persist
« Reply #2 on: May 21, 2012, 01:41:08 AM »
You can do something like this:
Code: [Select]
$ touch mymarker
[do whatever causes the settings to be stored]
$ sudo find / -not -type 'd' -cnewer mymarker | grep -v "\/proc\/" | grep -v "^\/sys\/" | tee files
$ vi files

This probably requires the findutils extension

This seems quite dreadful set of commands to me. Can you please explain what these try to achieve?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: Settings for iptables does not persist
« Reply #3 on: May 21, 2012, 01:43:15 AM »
This will make a list of all files created after the "touch mymarker" command and thus will tell you where the iptables rules are stored.

Offline Holmes.Sherlock

  • Newbie
  • *
  • Posts: 25
    • Team Reboot
Re: Settings for iptables does not persist
« Reply #4 on: May 21, 2012, 01:44:30 AM »
This will make a list of all files created after the "touch mymarker" command and thus will tell you where the iptables rules are stored.

I see, quite roundabout a way.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: Settings for iptables does not persist
« Reply #5 on: May 21, 2012, 05:05:01 AM »
If you manually type them, they are not stored anywhere. Merely made active in the kernel.
The only barriers that can stop you are the ones you create yourself.

Offline Holmes.Sherlock

  • Newbie
  • *
  • Posts: 25
    • Team Reboot
Re: Settings for iptables does not persist
« Reply #6 on: May 21, 2012, 05:09:47 AM »
If you manually type them, they are not stored anywhere. Merely made active in the kernel.


Yes, I need to use iptables-save & iptables-restore

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: Settings for iptables does not persist
« Reply #7 on: May 21, 2012, 05:15:00 AM »
Those commands work on stdout and stdin, so where the results are stored is up to you :)
The only barriers that can stop you are the ones you create yourself.

Offline Holmes.Sherlock

  • Newbie
  • *
  • Posts: 25
    • Team Reboot
Re: Settings for iptables does not persist
« Reply #8 on: May 21, 2012, 05:16:13 AM »
Those commands work on stdout and stdin, so where the results are stored is up to you :)


I will store them in persistent storage & load back using startup script.