Using route to fuck gfw!

Posted: March 16, 2011 in GFW, Uncategorized
Tags: ,

You can use route command to smart your vpn traffic.

add some rules to your pptp /etc/ppp/ip-up:

#!/bin/sh
export PATH="/bin:/sbin:/usr/sbin:/usr/bin"

LOCALGATEWAY=`netstat -nr | grep '^default' | grep -v 'ppp' | sed 's/default *([0-9.]*) .*/1/'`


if [ ! -e /tmp/pptp_localgateway ]; then
    echo "${LOCALGATEWAY}" > /tmp/pptp_localgateway
fi

dscacheutil -flushcache


route add 1.12.0/14 "${LOCALGATEWAY}"
route add 1.24.0/13 "${LOCALGATEWAY}"
route add 1.45.0/16 "${LOCALGATEWAY}"

and /etc/ppp/ip-down:

#!/bin/sh
export PATH="/bin:/sbin:/usr/sbin:/usr/bin"


if [ ! -e /tmp/pptp_localgateway ]; then
        exit 0
fi

LOCALGATEWAY=`cat /tmp/pptp_localgateway`


route delete 1.12.0/14 ${LOCALGATEWAY}
route delete 1.24.0/13 ${LOCALGATEWAY}
route delete 1.45.0/16 ${LOCALGATEWAY}
route delete 1.48.0/14 ${LOCALGATEWAY}

rm /tmp/pptp_localgateway

Notice: Do not forget to add 192.168.0/16 to your local gateway(maybe eth0, ppp0 for vpn gateway)

ipv4list

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s