Created
December 7, 2013 17:32
-
-
Save binux/7845821 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
# parameters | |
# $1 the interface name used by pppd (e.g. ppp3) | |
# $2 the tty device name | |
# $3 the tty device speed | |
# $4 the local IP address for the interface | |
# $5 the remote IP address | |
# $6 the parameter specified by the 'ipparam' option to pppd | |
ip rule | grep vpn || ip rule add table vpn | |
wget -O - http://autoddvpn.googlecode.com/svn/trunk/grace.d/vpnup.sh \ | |
| awk "/begin batch route/,/end batch route/" \ | |
| awk '/route add/ { print $4 }' \ | |
| tee /tmp/blocked_ips \ | |
| awk -v dev=$1 '{ print "ip route add "$1" table vpn dev "dev }' \ | |
| sh | |
ip route add 8.8.8.8 table vpn dev $1 | |
ip route add 8.8.4.4 table vpn dev $1 | |
# pixiv.net | |
ip route add 210.129.120.0/24 table vpn dev $1 | |
ip route add 210.168.27.0/24 table vpn dev $1 | |
# youtube | |
ip route add 173.194.51.0/24 table vpn dev $1 | |
ip route add 74.125.0.0/16 table vpn dev $1 | |
ip route add 188.254.87.0/14 table vpn dev $1 | |
# e-hentai | |
ip route add 5.79.76.0/24 table vpn dev $1 | |
ip route add 95.211.91.0/24 table vpn dev $1 | |
ip route add 95.211.201.0/24 table vpn dev $1 |
This file contains 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
# Put your custom commands here that should be executed once | |
# the system init finished. By default this file does nothing. | |
ip link add link eth0.2 eth2 type macvlan | |
ifconfig eth2 hw ether 02:07:62:53:E2:22 | |
ifconfig eth2 up | |
ip link add link eth0.2 eth3 type macvlan | |
ifconfig eth3 hw ether 6C:9A:7A:12:C3:3F | |
ifconfig eth3 up | |
sleep 10 && /etc/init.d/multiwan restart | |
sleep 60 && wget -O - http://smarthosts.googlecode.com/svn/trunk/hosts | grep -v github > /etc/hosts.smart & | |
sleep 60 && /root/run.sh & | |
sleep 60 && /root/dnspod.sh & | |
exit 0 |
This file contains 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/sh | |
started=0 | |
while : | |
do | |
dev=$(ip link | grep state | awk '{ sub(":", "", $2); print $2 }' | grep vpn) | |
if [ $? -ne 0 ]; then | |
sleep 5 | |
continue | |
fi | |
ip route list table vpn | grep -v static | grep -v src | grep vpn | |
if [ $? -eq 0 ]; then | |
sleep 20 | |
continue | |
fi | |
sh -x /etc/ppp/ip-up $dev | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment