不同网段间的切换脚本

经常在网段之间频繁切换,要重新设置IP,DNS服务器,代理地址实在是麻烦,

使用脚本会方便很多。

 

1、IP,DNS服务器切换脚本

192.168.20.77.bat
1 netsh interface ip set address local static 192.168.20.77 255.255.255.0 192.168.20.254 1
2
3 netsh interface ip set dns name="local" source=static addr=192.168.2.242 register=PRIMARY
4
5 netsh interface ip add dns name="local" addr=192.168.10.242 index=2
192.168.1.50.bat
1 netsh interface ip set address local static 192.168.1.50 255.255.255.0 192.168.1.1 1
2
3 netsh interface ip set dns name="local" source=static addr=192.168.1.1 register=PRIMARY

 

2、代理自动配置脚本

 如果在不同网段使用的不同的代理,可使用代理的自动配置脚本。

proxy.pac
function FindProxyForURL(url,host)
{

if(myIpAddress()=="192.168.20.77")
{
return "PROXY 192.168.2.250:80";
}

if(myIpAddress()=="192.168.1.50")
{
return "PROXY 192.168.1.254:8080";
}

return "direct";
}






 

 

转载于:https://www.cnblogs.com/yyangblog/archive/2011/10/12/2208256.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值