2007-11-16, 06:38 PM | #1 |
注册日期: 2003-10-22
帖子: 11,053
积分:6
精华:24
现金:14348金币
资产:29325305金币
|
[转贴]windows下用vpn借线自动设路由的脚本
首先申明,不是网吧间借线。 前两天在一个网吧安装了双线,我家是电信的adsl,上网通极慢,就在网吧m0n0做了个pptp服务,在家拨号后借他的双线。 拨号之后。注意一点,vpn拨号的ip,不要和你的局域网ip在一个网段。 二个批处理 1:vpn.bat 代码:
@echo off rasdial|find "没有连接" if ERRORLEVEL 1 goto conn rasdial vpn连接名 用户 密码 ipconfig|find "IP Add"|find "192.168.3.">ip.txt for /f "tokens=2 delims=:" %%i in (ip.txt) do set env_vpnIP_run=%%i del ip.txt call sroute.bat set env_vpnIP_run= goto end :conn rasdial /disconnect :end 代码:
@echo off route delete 0.0.0.0 %env_vpnIP_run% route add 192.168.3.0 mask 255.255.255.0 %env_vpnIP_run% route add 58.16.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 58.17.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 58.17.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 58.18.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 58.19.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 58.20.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 58.21.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 58.22.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 58.240.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 58.242.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 58.244.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 58.246.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 58.248.0.0 mask 255.248.0.0 %env_vpnIP_run% route add 60.0.0.0 mask 255.248.0.0 %env_vpnIP_run% route add 60.8.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 60.10.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 60.12.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 60.13.0.0 mask 255.255.192.0 %env_vpnIP_run% route add 60.13.64.0 mask 255.255.192.0 %env_vpnIP_run% route add 60.13.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 60.14.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 60.16.0.0 mask 255.248.0.0 %env_vpnIP_run% route add 60.24.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 60.30.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 60.31.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 60.218.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 60.220.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 61.48.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 61.52.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 61.54.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.55.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.133.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 61.134.96.0 mask 255.255.224.0 %env_vpnIP_run% route add 61.134.128.0 mask 255.255.192.0 %env_vpnIP_run% route add 61.134.192.0 mask 255.255.192.0 %env_vpnIP_run% route add 61.135.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.136.64.0 mask 255.255.192.0 %env_vpnIP_run% route add 61.137.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 61.138.0.0 mask 255.255.192.0 %env_vpnIP_run% route add 61.138.64.0 mask 255.255.192.0 %env_vpnIP_run% route add 61.138.128.0 mask 255.255.192.0 %env_vpnIP_run% route add 61.139.128.0 mask 255.255.192.0 %env_vpnIP_run% route add 61.148.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 61.156.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.158.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 61.159.0.0 mask 255.255.192.0 %env_vpnIP_run% route add 61.161.0.0 mask 255.255.192.0 %env_vpnIP_run% route add 61.161.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 61.162.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.163.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.167.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.168.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.176.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.179.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.181.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.182.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 61.189.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 121.16.0.0 mask 255.248.0.0 %env_vpnIP_run% route add 121.24.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 121.28.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 121.30.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 121.31.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 122.96.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 122.192.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 123.4.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 123.8.0.0 mask 255.248.0.0 %env_vpnIP_run% route add 124.64.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 124.66.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 124.67.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 124.88.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 124.89.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 124.89.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 124.90.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 124.92.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 124.128.0.0 mask 255.248.0.0 %env_vpnIP_run% route add 124.160.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 124.161.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 124.162.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 124.163.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 124.164.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 125.32.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 125.33.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 125.34.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 125.35.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 125.36.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 125.40.0.0 mask 255.248.0.0 %env_vpnIP_run% route add 202.96.0.0 mask 255.255.192.0 %env_vpnIP_run% route add 202.96.64.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.96.72.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.97.128.0 mask 255.255.192.0 %env_vpnIP_run% route add 202.97.224.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.97.240.0 mask 255.255.240.0 %env_vpnIP_run% route add 202.98.0.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.98.8.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.99.64.0 mask 255.255.224.0 %env_vpnIP_run% route add 202.99.96.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.99.128.0 mask 255.255.224.0 %env_vpnIP_run% route add 202.99.160.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.99.168.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.99.176.0 mask 255.255.240.0 %env_vpnIP_run% route add 202.99.208.0 mask 255.255.240.0 %env_vpnIP_run% route add 202.99.224.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.99.232.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.99.240.0 mask 255.255.240.0 %env_vpnIP_run% route add 202.102.128.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.102.224.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.102.232.0 mask 255.255.248.0 %env_vpnIP_run% route add 202.106.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 202.107.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 202.108.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 202.110.0.0 mask 255.255.192.0 %env_vpnIP_run% route add 202.110.64.0 mask 255.255.192.0 %env_vpnIP_run% route add 202.111.128.0 mask 255.255.224.0 %env_vpnIP_run% route add 202.130.224.0 mask 255.255.224.0 %env_vpnIP_run% route add 203.93.8.0 mask 255.255.255.0 %env_vpnIP_run% route add 203.93.192.0 mask 255.255.192.0 %env_vpnIP_run% route add 210.13.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 210.14.160.0 mask 255.255.224.0 %env_vpnIP_run% route add 210.14.192.0 mask 255.255.224.0 %env_vpnIP_run% route add 210.15.32.0 mask 255.255.224.0 %env_vpnIP_run% route add 210.15.96.0 mask 255.255.224.0 %env_vpnIP_run% route add 210.15.128.0 mask 255.255.192.0 %env_vpnIP_run% route add 210.21.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 210.52.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 210.53.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 210.53.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 210.74.96.0 mask 255.255.224.0 %env_vpnIP_run% route add 210.74.128.0 mask 255.255.224.0 %env_vpnIP_run% route add 210.78.0.0 mask 255.255.224.0 %env_vpnIP_run% route add 210.82.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 211.144.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 218.8.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 218.10.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 218.11.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 218.12.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 218.21.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 218.24.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 218.27.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 218.56.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 218.60.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 218.67.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 218.68.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 218.104.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 218.104.128.0 mask 255.255.224.0 %env_vpnIP_run% route add 218.104.160.0 mask 255.255.224.0 %env_vpnIP_run% route add 218.104.192.0 mask 255.255.248.0 %env_vpnIP_run% route add 218.104.200.0 mask 255.255.248.0 %env_vpnIP_run% route add 218.104.224.0 mask 255.255.224.0 %env_vpnIP_run% route add 218.105.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 218.106.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 219.154.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 219.156.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 219.158.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 219.158.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 219.159.0.0 mask 255.255.192.0 %env_vpnIP_run% route add 219.232.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 220.252.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.0.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 221.2.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.3.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 221.3.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 221.4.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.5.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 221.5.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 221.6.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.7.0.0 mask 255.255.224.0 %env_vpnIP_run% route add 221.7.32.0 mask 255.255.224.0 %env_vpnIP_run% route add 221.7.64.0 mask 255.255.224.0 %env_vpnIP_run% route add 221.7.96.0 mask 255.255.224.0 %env_vpnIP_run% route add 221.7.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 221.10.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.11.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 221.11.128.0 mask 255.255.192.0 %env_vpnIP_run% route add 221.11.224.0 mask 255.255.224.0 %env_vpnIP_run% route add 221.12.0.0 mask 255.255.128.0 %env_vpnIP_run% route add 221.12.128.0 mask 255.255.192.0 %env_vpnIP_run% route add 221.13.0.0 mask 255.255.192.0 %env_vpnIP_run% route add 221.13.64.0 mask 255.255.224.0 %env_vpnIP_run% route add 221.13.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 221.14.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 221.192.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 221.194.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.195.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.196.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 221.198.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.199.0.0 mask 255.255.224.0 %env_vpnIP_run% route add 221.199.64.0 mask 255.255.192.0 %env_vpnIP_run% route add 221.199.128.0 mask 255.255.192.0 %env_vpnIP_run% route add 221.199.192.0 mask 255.255.240.0 %env_vpnIP_run% route add 221.199.224.0 mask 255.255.224.0 %env_vpnIP_run% route add 221.200.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 221.204.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 221.206.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.207.0.0 mask 255.255.192.0 %env_vpnIP_run% route add 221.207.64.0 mask 255.255.192.0 %env_vpnIP_run% route add 221.207.128.0 mask 255.255.128.0 %env_vpnIP_run% route add 221.208.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 221.212.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.213.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 221.216.0.0 mask 255.248.0.0 %env_vpnIP_run% route add 222.128.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 222.132.0.0 mask 255.252.0.0 %env_vpnIP_run% route add 222.136.0.0 mask 255.248.0.0 %env_vpnIP_run% route add 222.160.0.0 mask 255.254.0.0 %env_vpnIP_run% route add 222.162.0.0 mask 255.255.0.0 %env_vpnIP_run% route add 222.163.0.0 mask 255.255.224.0 %env_vpnIP_run% route add 222.163.32.0 mask 255.255.224.0 %env_vpnIP_run% route add 222.163.64.0 mask 255.255.192.0 %env_vpnIP_run% route add 222.163.128.0 mask 255.255.128.0 %env_vpnIP_run% 批处理中的 192.168.3 替换成你自己的vpn网段。 |
|