#!/bin/bash

MY_GW="xxx.xxx.xxx.xxx"

start(){
echo "Starting VPN Fake...              "

/sbin/modprobe ipip && \
/sbin/modprobe ip_gre && \
/sbin/ip route add 82.211.136.2 via ${MY_GW} && \
/usr/sbin/pptp 82.211.136.2 call pptpfake && \
/bin/sleep 10 && \
/sbin/ip route delete default && \
/sbin/ip route add default dev ppp0 && \
echo "OK"
}

stop(){
/usr/bin/killall -9 pptp
/sbin/ip route delete 82.211.136.2 > /dev/null 2>&1
/sbin/ip route delete default && \
/sbin/ip route add default via ${MY_GW}
}

case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
*)
        echo "usage: $0 start|stop "
        ;;
esac