免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1173 | 回复: 0
打印 上一主题 下一主题

如何方便地切换IP地址 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-03-19 07:45 |只看该作者 |倒序浏览

  经常到各家医院出差,经常要配不同局域网的地址,另外许多医院的因特网和局域网是物理隔离的,为了上网必须不停切换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
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP