Results 1 to 3 of 3

Thread: IPtables rules not persistant

  1. #1
    Join Date
    Mar 2007

    IPtables rules not persistant

    I had a problem with one of my 18.04 computers (formerly 16.04) that has a bunch of site specific iptables.rules. The onboard NIC went out. I installed a new NIC and it started working immediately as expected, except of course the iptable.rules were not loaded.
    I edited the iptables.rules file with the new network interface name (eth1) and loaded the iptables rules with:
    iptables-restore < iptables.rules
    That worked great I was back in business.
    I rebooted the computer to see if the rules would be reloaded as they always had been before. It didn't work.
    I tried:
    # apt-get install iptables-persistent
    Got that the version installed was already the latest.
    I then tried to save the loaded rules;
    # iptables-save > /etc/iptables/rules.v4
    # ip6tables-save > /etc/iptables/rules.v6
    That worked the files now contain the correct rules.
    But it still not loading on reboot.
    ufw is inactive and As far as I know always has been.
    It's been so long since I set this up (years) - either I've forgotten what I did or they've changed something.
    Honest it worked yesterday before the NIC failed.

  2. #2
    Join Date
    Jul 2021

    Re: IPtables rules not persistant

    What you've stated is what I do. I would double-check filename and permissions. No errors reported during restore?

  3. #3
    Join Date
    Mar 2007

    Re: IPtables rules not persistant

    OK I found the answer. Apparently some time ago (years) I have edited /etc/network/interfaces to read the /etc/iptables.rules file and install the rules saved there. I edited that file /etc/network/interfaces file again to update the name of the interface and all is good now.
    Another thing to add to my ever growing list of things to clean up.

    I'll mark this solved now.


Posting Permissions

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