WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline Holmes.Sherlock

  • Newbie
  • *
  • Posts: 25
    • Team Reboot
Settings for iptables does not persist
« on: May 20, 2012, 10:24:48 PM »
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.

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14554
Re: Settings for iptables does not persist
« Reply #1 on: May 20, 2012, 10:39:10 PM »
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 20, 2012, 10:41:08 PM »
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?

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14554
Re: Settings for iptables does not persist
« Reply #3 on: May 20, 2012, 10:43:15 PM »
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 20, 2012, 10:44:30 PM »
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: 10963
Re: Settings for iptables does not persist
« Reply #5 on: May 21, 2012, 02: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, 02: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: 10963
Re: Settings for iptables does not persist
« Reply #7 on: May 21, 2012, 02: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, 02: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.