Skip to content

Instantly share code, notes, and snippets.

@eshch
Created March 12, 2018 12:59
Show Gist options
  • Save eshch/3e07df1895bc1cee217452e050648beb to your computer and use it in GitHub Desktop.
Save eshch/3e07df1895bc1cee217452e050648beb to your computer and use it in GitHub Desktop.
#!/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