The Official Site of David Guest

Persistent iptables

Out of the box, any changes you make to your iptables on Linux will be discarded on reboot. That might not always be desirable. There’s a package sitting in the repos for Ubuntu that allows your changes to persist.

sudo apt install iptables-persistent

On install it offers the option to save the current iptables configuration. The config gets saved in /etc/iptables/rules.v4 (and rules.v6 for ipv6).

You can save any further rule changes using iptables-save, which spits out the entire ruleset on stdout. A quick way to save your rule changes forever:

iptables-save > /etc/iptables/rules.v4
Simple!

(copied from my old site)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.