- 论坛徽章:
- 0
|
经常到各家医院出差,经常要配不同局域网的地址,另外许多医院的因特网和局域网是物理隔离的,为了上网必须不停切换IP地址。
方法一:
一种简单的方法是使用netsh命令,把不同地址配置编写为批处理文件,例如:
netsh interface ip set address name=本地连接source=static addr=192.168.100.199 mask=255.255.255.0
有一篇IP切换的批处理文件:
@echo off
echo ******************************************************************
echo **自动IP修改器:IPChange **
echo ** LeeWenjie2006-11-26 **
echo ******************************************************************
echo **选项说明 **
echo ** [F]: Family 自动获承IP **
echo ** [5]: Office5网关192.168.22.5 **
echo ** [2]: Office2网关192.168.22.2 **
echo ** [P]: Pantry 厦航网关 **
echo ** [C}: Cancel 取消操作 **
echo ******************************************************************
echo **请选择: **
choice /c f52pc /m [Family,Office5,Office2,Pantry,Cancel] /D 2 /T 10
if errorlevel 5 goto end
if errorlevel 4 goto pantry
if errorlevel 3 goto office2
if errorlevel 2 goto office5
if errorlevel 1 goto family
:family
echo Set Family's IP Start......
netsh interface ip reset log.txt
netsh interface set interface本地连接disable
netsh interface ip set address name=本地连接source=dhcp
netsh interface ip set address name=本地连接gateway=none
netsh interface set interface本地连接enable
dellog.txt
echo Set Family's IP End.
goto end
:office5
echo Set Office5's IF start......
netsh interface ip reset log.txt
netsh interface ip set address name=本地连接source=static addr=192.168.22.111 mask=255.255.255.0
netsh interface ip set address name=本地连接gateway=192.168.22.5 gwmetric=0
netsh interface ip set dns name=本地连接source=static addr=202.101.103.55 register=PRIMARY
dellog.txt
echo Set Office5's IP End.
goto end
:office2
echo Set Office2's IP Start......
netsh interface ip reset log.txt
netsh interface ip set address name=本地连接source=static addr=192.168.22.111 mask=255.255.255.0
netsh interface ip set address name=本地连接gateway=192.168.22.2 gwmetric=0
netsh interface ip set dns name=本地连接source=static addr=202.101.103.55 register=PRIMARY
dellog.txt
echo Set Office2's IP End.
goto end
:pantry
echo Set Pantry's IP Start......
netsh interface ip reset log.txt
netsh interface ip set address name=本地连接source=static addr=192.168.1.199 mask=255.255.255.0
netsh interface ip set address name=本地连接gateway=192.168.1.254 gwmetric=0
netsh interface ip set dns name=本地连接source=static addr=202.101.103.55 register=PRIMARY
dellog.txt
echo Set Pantry's IP End.
goto end
:end
echo Good Lock
@echo on
方法2:
第二种方法使用软件。例如IPCHANGER , IPHELPER
我使用的是IPHELPER(
http://www.4w5w.com/soft/
),因为它是绿色的、免费的、没有限制的。但说实话,它的可用性没有其它商用的好。好在也用习惯了。
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/63669/showart_499316.html |
|