Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added netfilter-persistent as init.d is part of that package

...

Code Block
languagebash
sudo chkconfig iptables on
sudo service iptables save

Debian/Ubuntu:

Install iptables-persistent package and the netfilter-persistent  packages:

Code Block
languagebash
sudo apt-get install iptables-persistent
sudo apt-get install netfilter-persistent

To save current iptable rules to these files, run the following:

...

Code Block
languagebash
sudo iptables-restore < /etc/iptables/rules.v4
sudo ip6tables-restore < /etc/iptables/rules.v6

The netfilter-persistent  package has the actual init.d service which reloads the last saved iptables configuration.  So, once saved (see above) start and enable the service by:

Code Block
sudo systemctl start netfilter-persistent
sudo systemctl enable netfilter-persistent

References

  1. https://help.ubuntu.com/community/IptablesHowTo
  2. https://www.thomas-krenn.com/en/wiki/Saving_Iptables_Firewall_Rules_Permanently

...