Skip to main content

Dynamically save and restore iptables rules for some chain(s)

Project description

Dynamically save and restore iptables rules for some chain(s)


When there’s an iptables service restart, all of the docker rules gets wiped out. This script was written to dynamically save and restore iptables rules pertaining to some chain(s) and make them persist.


  • iptables (Must have the commands iptables-save and iptables-restore commands available)


pip install iptables-dynamic


iptables-dynamic --chains DOCKER SOME-OTHER-CHAIN --save

which would save them at /etc/iptables/rules.v4

One can restore those rules by

iptables-dynamic --restore

One may also use ip6tables-dynamic for IPv6.


The copyright owner is Regents of the University of California and this script is published under a BSD 3-Clause license.

Developed at UCSB LSIT

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for iptables-dynamic, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size iptables_dynamic-0.2.1-py2.py3-none-any.whl (10.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size iptables-dynamic-0.2.1.tar.gz (5.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page