Merge pull request #12 from compressed/dup_iptables
avoid dup iptables rules
This commit is contained in:
commit
b06631099f
@ -19,10 +19,13 @@ fi
|
|||||||
|
|
||||||
# Setup NAT forwarding if requested
|
# Setup NAT forwarding if requested
|
||||||
if [ "$OVPN_DEFROUTE" != "0" ];then
|
if [ "$OVPN_DEFROUTE" != "0" ];then
|
||||||
iptables -t nat -A POSTROUTING -s $OVPN_SERVER -o eth0 -j MASQUERADE
|
iptables -t nat -C POSTROUTING -s $OVPN_SERVER -o eth0 -j MASQUERADE || {
|
||||||
|
iptables -t nat -A POSTROUTING -s $OVPN_SERVER -o eth0 -j MASQUERADE
|
||||||
|
}
|
||||||
for i in "${OVPN_ROUTES[@]}"; do
|
for i in "${OVPN_ROUTES[@]}"; do
|
||||||
iptables -t nat -A POSTROUTING -s "$i" -o eth0 -j MASQUERADE
|
iptables -t nat -C POSTROUTING -s "$i" -o eth0 -j MASQUERADE || {
|
||||||
|
iptables -t nat -A POSTROUTING -s "$i" -o eth0 -j MASQUERADE
|
||||||
|
}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user