Categories
Unix Admin

How to persist iptables settings on debian

Use iptables-persistent instead of old way of iptables-save and iptables-restore to automate saving and restoring during reboots. Just remember to still perform iptables-save after any rule change.

The old way was to do an iptables-save each time an update to iptables rules is made and then iptables-restore during system startup. New way is to use iptables-persistent which takes care of both of these.

Install iptables-persist using deb package/apt or tool of your choice on the Linux of your choice. On debian during install it will ask to save currently active ipv4 and ipv6 rules and setup necessary restore processes. That’s all!