Results 1 to 4 of 4

Thread: iptables-persistent not saved at reboot

  1. #1
    Join Date
    Jun 2012
    Beans
    28

    Question iptables-persistent not saved at reboot

    Hello,

    Bit new to this, so sorry to ask but;
    I installed iptables-persistent and saved the rules using:
    sudo /sbin/iptables-save > /etc/iptables/rules.v4
    sudo /sbin/ip6tables-save > /etc/iptables/rules.v6

    And indeed the rules are there, but I noticed they do not change after reboot.
    Meaning the rules are from the one time I saved them manually and are not saved before reboot.
    Making new rules are lost after reboot...

    Is there anything I have to configure? Did I miss something here?

    Currently using Ubuntu 22.04.3 LTS

  2. #2
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,703

    Re: iptables-persistent not saved at reboot

    That's right. iptables-persistent loads whatever is configured in iptables.rules when the machine boots. It does not save any other changes that you made directly into the active configuration. You have to manually save after any changes that you want to keep. So if you royally mess up the current rules (not uncommon), a reboot will get you back to a known state.

  3. #3
    Join Date
    Jun 2012
    Beans
    28

    Re: iptables-persistent not saved at reboot

    So better to ask, how do I save and restore automagically as iptables-persistent is not doing this (as I had hopped)?

    Just one more note: I did read about netfilter-persistent (part of iptables-persistent) and it says:

    netfilter-persistent uses a set of plugins to load, flush and save netfilter rules at boot and halt time.

    Does this mean it should be save at shutdown (halt) or reboot?
    Last edited by matthys; December 26th, 2023 at 09:23 PM.

  4. #4
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,703

    Re: iptables-persistent not saved at reboot

    I did read about netfilter-persistent
    Read it again. netfilter-persistent (which you did not ask about) has a save option to tell it to save the current configuration:
    https://manpages.ubuntu.com/manpages...sistent.8.html

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •