Created
March 12, 2018 12:59
-
-
Save eshch/3e07df1895bc1cee217452e050648beb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NET=10.255.255.248 | |
MASK=255.255.255.248 | |
RULE="POSTROUTING -t nat -s $NET/$MASK -o eth0 -j MASQUERADE" | |
set -x | |
echo 1 > /proc/sys/net/ipv4/ip_forward | |
while true; do | |
eval iptables -D $RULE | |
if [[ $? != 0 ]]; then | |
break | |
fi | |
done | |
eval iptables -A $RULE | |
openvpn --config server.ovpn --server $NET $MASK & | |
#watch 'sudo iptables -vL -t nat' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment