-+-
After connecting to the VPN server, can't access the sites. Need to add stuff to the routing table. Wrote the bash script for that:
Soon after getting connected on VPN, do
ifconfig
, get the IP address associated to the ppp0 (p-t-p), specify your local router gateway and the interface you are connected through (wireless or wired) and fire the script! #!bin/sh
# Check for command line
if [ -z "$1" ]; then
echo "usage: ./vpn.sh [p-t-p] [GW] [Interface]"
exit
fi
if [ -z "$2" ]; then
echo "usage: ./vpn.sh [p-t-p] [GW] [Interface]"
exit
fi
if [ -z "$3" ]; then
echo "usage: ./vpn.sh [p-t-p] [GW] [Interface]"
exit
fi
VPN_REMOTE_IP=$1
ALLTARGET="198.82.0.0/16" # All class C addresses
GATEWAY=$2
INTERFACE=$3 #eth0 or eth1
# change!
route add -host $VPN_REMOTE_IP gw $GATEWAY dev $INTERFACE
route add -net $ALLTARGET dev ppp0
Run this script as sudo!
No comments:
Post a Comment