Created
December 3, 2017 07:02
-
-
Save kyxap1/1695356e47b2686537ce9795d906f0a3 to your computer and use it in GitHub Desktop.
VPN routing script for Asus RT-N56U
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 | |
### Custom user script | |
### Called after internal VPN client connected/disconnected to remote VPN server | |
### $1 - action (up/down) | |
### $IFNAME - tunnel interface name (e.g. ppp5 or tun0) | |
### $IPLOCAL - tunnel local IP address | |
### $IPREMOTE - tunnel remote IP address | |
### $DNS1 - peer DNS1 | |
### $DNS2 - peer DNS2 | |
ACTION=${1} | |
DEBUG=1 | |
google="64.18.0.0/20 64.233.160.0/19 66.102.0.0/20 66.249.80.0/20 72.14.192.0/18 74.125.0.0/16 108.177.8.0/21 173.194.0.0/16 207.126.144.0/20 209.85.128.0/17 216.239.32.0/19 216.58.192.0/19" | |
akamai="2.16.0.0/13 23.192.0.0/11 104.64.0.0/10" | |
kinopub="212.224.112.0/20" | |
func_res() { | |
[[ ${DEBUG:-0} -ge 1 ]] && set 2>&1 | logger -t vpnc-script | |
set -- ${google} ${akamai} ${kinopub} | |
for net; do echo "ip route ${ACTION} $net via ${route_vpn_gateway} dev ${IFNAME} src ${IPLOCAL}"; done | |
return 0 | |
} | |
case "$ACTION" in | |
up) | |
ACTION=add | |
;; | |
down) | |
ACTION=del | |
;; | |
esac | |
func_res | sh 2>&1 | logger -t vpnc-script | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment