-
Notifications
You must be signed in to change notification settings - Fork 99
PPP on OpenWRT
Xiaoyi edited this page Sep 28, 2015
·
4 revisions
用于更新 OpenWRT 路由器路由表的简单脚本。
#!/bin/bash
bestroutetb \
--output 20-route \
--route.net=cn,0.0.0.0/0 \
--route.vpn=us \
--profile=custom \
--no-default-gateway \
--group-gateway \
--header=$'#!/bin/sh\necho `date` $6-online >> /tmp/ppplog\ncase "$6" in\n' \
--group-name.net=wan \
--group-name.vpn=vpn \
--group-header=$'%name)\nip -b - <<FILE\n' \
--rule-format=$'r a %prefix/%length via %gw\n' \
--group-footer=$'FILE\n;;\n' \
--footer=$'esac\nexit 0\n' \
--gateway.net='$5' \
--gateway.vpn='$5' \
-vvf
chmod +x 20-route
scp 20-route [email protected]:/etc/ppp/ip-up.d/
rm -f 20-route
生成的 20-route
:
#!/bin/sh
echo `date` $6-online >> /tmp/ppplog
case "$6" in
vpn)
ip -b - <<FILE
r a 0.0.0.0/1 via $5
r a 60.254.0.0/16 via $5
r a 103.246.192.0/18 via $5
r a 113.28.0.0/15 via $5
r a 128.0.0.0/1 via $5
r a 150.242.216.0/21 via $5
r a 171.64.0.0/12 via $5
r a 202.72.96.0/19 via $5
r a 203.144.0.0/18 via $5
r a 203.187.128.0/19 via $5
FILE
;;
wan)
ip -b - <<FILE
r a 0.0.0.0/7 via $5
r a 14.0.0.0/8 via $5
r a 27.0.0.0/8 via $5
r a 36.0.0.0/8 via $5
r a 39.0.0.0/8 via $5
r a 42.0.0.0/7 via $5
r a 45.64.0.0/13 via $5
r a 45.96.0.0/11 via $5
r a 47.92.0.0/14 via $5
r a 47.96.0.0/11 via $5
r a 49.0.0.0/8 via $5
r a 54.222.0.0/15 via $5
r a 58.0.0.0/7 via $5
r a 60.0.0.0/7 via $5
r a 91.232.0.0/13 via $5
r a 101.0.0.0/8 via $5
r a 102.0.0.0/7 via $5
r a 106.0.0.0/8 via $5
r a 110.0.0.0/7 via $5
r a 112.0.0.0/4 via $5
r a 139.0.0.0/12 via $5
r a 139.128.0.0/15 via $5
r a 139.148.0.0/15 via $5
r a 139.152.0.0/13 via $5
r a 139.170.0.0/16 via $5
r a 139.176.0.0/16 via $5
r a 139.183.0.0/16 via $5
r a 139.186.0.0/16 via $5
r a 139.188.0.0/14 via $5
r a 139.192.0.0/11 via $5
r a 139.224.0.0/16 via $5
r a 139.226.0.0/15 via $5
r a 140.75.0.0/16 via $5
r a 140.143.0.0/16 via $5
r a 140.205.0.0/16 via $5
r a 140.206.0.0/15 via $5
r a 140.210.0.0/16 via $5
r a 140.224.0.0/16 via $5
r a 140.237.0.0/16 via $5
r a 140.240.0.0/16 via $5
r a 140.243.0.0/16 via $5
r a 140.246.0.0/16 via $5
r a 140.249.0.0/16 via $5
r a 140.250.0.0/16 via $5
r a 140.255.0.0/16 via $5
r a 144.0.0.0/15 via $5
r a 144.6.0.0/15 via $5
r a 144.12.0.0/16 via $5
r a 144.52.0.0/14 via $5
r a 144.122.0.0/15 via $5
r a 144.255.0.0/16 via $5
r a 150.0.0.0/10 via $5
r a 150.115.0.0/16 via $5
r a 150.121.0.0/16 via $5
r a 150.122.0.0/16 via $5
r a 150.128.0.0/15 via $5
r a 150.138.0.0/15 via $5
r a 150.223.0.0/16 via $5
r a 150.242.0.0/16 via $5
r a 150.254.0.0/15 via $5
r a 152.104.0.0/13 via $5
r a 153.0.0.0/15 via $5
r a 153.3.0.0/16 via $5
r a 153.34.0.0/15 via $5
r a 153.36.0.0/15 via $5
r a 153.96.0.0/14 via $5
r a 153.100.0.0/15 via $5
r a 153.118.0.0/15 via $5
r a 157.0.0.0/12 via $5
r a 157.16.0.0/14 via $5
r a 157.61.0.0/16 via $5
r a 157.122.0.0/16 via $5
r a 157.148.0.0/16 via $5
r a 157.156.0.0/14 via $5
r a 157.255.0.0/16 via $5
r a 159.226.0.0/16 via $5
r a 161.207.0.0/16 via $5
r a 162.105.0.0/16 via $5
r a 163.0.0.0/15 via $5
r a 163.44.0.0/14 via $5
r a 163.48.0.0/12 via $5
r a 163.125.0.0/16 via $5
r a 163.136.0.0/13 via $5
r a 163.177.0.0/16 via $5
r a 163.178.0.0/15 via $5
r a 163.204.0.0/16 via $5
r a 166.110.0.0/15 via $5
r a 167.139.0.0/16 via $5
r a 167.189.0.0/16 via $5
r a 167.220.244.0/22 via $5
r a 168.160.0.0/16 via $5
r a 171.0.0.0/9 via $5
r a 171.208.0.0/12 via $5
r a 175.0.0.0/8 via $5
r a 180.0.0.0/6 via $5
r a 192.124.154.0/23 via $5
r a 192.188.168.0/22 via $5
r a 202.0.0.0/7 via $5
r a 210.0.0.0/7 via $5
r a 218.0.0.0/7 via $5
r a 220.0.0.0/6 via $5
FILE
;;
esac
exit 0