标题: vista下如何使用route add
作者: Bahamut 时间: 2008-6-16 14:22 标题: vista下如何使用route add
换了vista后在公司无法通过route add 实现同时连接内、外网了,要如何才能解决呢?
下面是执行脚本
Echo off
echo add ip address...
Netsh interface IP set address name="本地连接" source=static addr=192.168.0.253 mask=255.255.255.0 gateway=192.168.0.1 1
Netsh interface IP add Address "本地连接" 192.168.71.253 255.255.255.0 192.168.71.254 1
echo add tow dns...
netsh interface ip set dns name="本地连接" source=static addr=61.128.128.253 register=PRIMARY
netsh interface ip add dns name="本地连接" addr=61.128.192.68 index=2
echo add Route...
Route add 10.0.0.0 mask 255.0.0.0 192.168.0.1 metric 1
Route add 172.16.0.0 mask 255.255.0.0 192.168.0.1 metric 1
Route delete 0.0.0.0
Route add 0.0.0.0 mask 0.0.0.0 192.168.71.254 metric 10
pause
具体错误是 “无法找到元素”
作者: Bahamut 时间: 2008-6-16 15:10
在网上搜也找不到什么有用的资料,有人说vista下route add 有问题.
如果有其他方法能实现同时连接内网与外网就可以了
有什么软件能实现么?
作者: Bahamut 时间: 2008-6-16 17:25
问题解决,不过解决的自己都感到莫名其妙
原批处理语句
Echo off
echo add ip address...
Netsh interface IP set address name="本地连接" source=static addr=192.168.0.223 mask=255.255.255.0 gateway=192.168.0.1 1
Netsh interface IP add Address "本地连接" 192.168.71.253 255.255.255.0 192.168.71.224 1
echo add tow dns...
netsh interface ip set dns name="本地连接" source=static addr=61.128.128.86 register=PRIMARY
netsh interface ip add dns name="本地连接" addr=61.128.192.68 index=2
echo add Route...
Route add 10.0.0.0 mask 255.0.0.0 192.168.0.1 metric 1
Route delete 0.0.0.0
Route add 0.0.0.0 mask 0.0.0.0 192.168.71.254 metric 10
pause
-------------
执行信息
D:/>Echo off
add ip address...
add tow dns...
add Route...
路由添加失败: 不能访问网络位置。有关网络排除故障的信息,请参阅 Windows 帮助。
好吧!
路由添加失败: 找不到元素。
请按任意键继续. . .
-----------------------------------
-----------------------------------
修改后批处理语句
Echo off
echo add ip address...
Netsh interface ipv4 set address name="本地连接" source=static addr=192.168.0.223 mask=255.255.255.0 gateway=192.168.0.1 IF 1
Netsh interface ipv4 add Address "本地连接" addr=192.168.71.223 255.255.255.0 192.168.71.254 IF 1
echo add tow dns...
netsh interface ipv4 set dns name="本地连接" source=static addr=61.128.128.223 register=PRIMARY
netsh interface ipv4 add dns name="本地连接" addr=61.128.192.68 index=2
echo add Route...
Route -4 add 10.0.0.0 mask 255.0.0.0 192.168.0.1 metric 1
Route -4 delete 0.0.0.0
Route -4 add 0.0.0.0 mask 0.0.0.0 192.168.71.254 metric 10
pause
---------------
执行结果
D:/>Echo off
add ip address...
无效 gwmetric 参数 (IF)。
无效 gwmetric 参数 (IF)。
add tow dns...
add Route...
好吧!
好吧!
好吧!
请按任意键继续. . .
虽然修改后设置ip时出了错,但因为这个错误,设置路由的错误消失了,并且ip是成功设置了的
作者: Bahamut 时间: 2008-6-16 17:29
上面设置路由时语句改成了 route -4
也许会误导认为是这句起了作用,实际并非如此,设置ip时不加 if 1 ,设置路由加了-4 也会出错
虽然设置成功了,自己却更迷糊了...
route -p ADD 222.192.0.0 MASK 255.240.0.0 %gw%
route如果不带上-p参数,重启之后路由就没了,还得重新设置。用管理员身份运行这个批处理文件。