From f8b91f65a445fa43a06545dc5e73d2a4ff6cc333 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Fri, 22 Jan 2016 11:14:58 -0600 Subject: [PATCH] Check for iptables-persistent and copy new rules --- vpnsetup.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vpnsetup.sh b/vpnsetup.sh index ef0ee50..6df3eec 100644 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -327,6 +327,11 @@ iptables -t nat -I POSTROUTING -s 192.168.42.0/24 -o eth+ -j SNAT --to-source "$ echo "# Modified by hwdsl2 VPN script" > /etc/iptables.rules /sbin/iptables-save >> /etc/iptables.rules fi +# Update rules for iptables-persistent +if [ -f /etc/iptables/rules.v4 ]; then +/bin/cp -f /etc/iptables/rules.v4 "/etc/iptables/rules.v4.old-${SYS_DT}" +/bin/cp -f /etc/iptables.rules /etc/iptables/rules.v4 +fi fi # Create basic IP6Tables (IPv6) rules @@ -346,6 +351,11 @@ cat > /etc/ip6tables.rules <