Board logo

标题: 电信ADSL和教育网之间的切换 [打印本页]

作者: 1112yuhua     时间: 2007-8-1 11:35    标题: 电信ADSL和教育网之间的切换

本人宿舍既能用电信ADSL上网,也能上校园网(教育网),所以经常要在两者之间切换,因此作了以下批处理。(注:电信采用自动分配IP,校园网则设定IP )
@echo off
echo 用于电信ADSL与教育网之间的切换
set s=2
set eth=本地连接
ipconfig /all | find "10.10.99.254" >nul && set s=1
goto n%s%
:n1
echo 教育网-->电信ADSL...
netsh interface ip set address name=%eth% source=dhcp >nul
netsh interface ip set dns name=%eth% source=dhcp register=PRIMARY >nul
goto n3
:n2
echo 电信ADSL-->教育网...
netsh interface ip set address name=%eth% source=static addr=10.10.99.214 mask=255.0.0.0 gateway=10.10.99.254 gwmetric=0 >nul
netsh interface ip set dns name=%eth% source=static addr=202.117.112.3 register=PRIMARY >nul
netsh interface ip add dns name=%eth% addr=218.30.19.40 index=2 >nul
goto n3
:n3
exit
@echo on
以上方法虽然可行,但是速度很慢,各位高手有更好的方法请指教。
作者: slore     时间: 2007-8-1 12:54
2个网卡行么?