Skip to content

Instantly share code, notes, and snippets.

@msturgill
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msturgill/9224437 to your computer and use it in GitHub Desktop.
Save msturgill/9224437 to your computer and use it in GitHub Desktop.
iptables persistence
/etc/network/if-pre-up.d/ip-pre
#!/bin/bash
test "$IFACE"="eth1" || exit 0
/sbin/iptables-restore -c < /etc/iptables.rules
/sbin/ip6tables-restore -c < /etc/ip6tables.rules
/etc/network/if-post-down.d/ip-post
#!/bin/bash
test "$IFACE"="eth1" || exit 0
/sbin/iptables-save -c > /etc/iptables.rules
/sbin/ip6tables-save -c > /etc/ip6tables.rules
chmod 600 /etc/iptables.rules
chmod 600 /etc/ip6tables.rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment