工具——自动设置本地连接的IP地址——联调测试脚本

来源:互联网 发布:淘宝网首页舞蹈服装 编辑:程序博客网 时间:2024/06/08 04:24

Windows下自动设置本地连接的IP地址脚本


1、自动获取IP
netsh interface ip set address name="local" source=dhcp
netsh interface ip set dns name="local" source=dhcp

2、netsh interface ip set address 本地连接 static 192.168.1.150 255.255.252.0 192.168.1.1 
netsh interface ip set address local static 192.168.1.150 255.255.252.0 192.168.1.1?

@netsh interface ip set dns local 192.168.0.254 

@netsh interface ip add dns local 202.106.196.115 index=2 

@netsh interface ip add dns local 202.106.0.20 index=3 

3、netsh interface ip set address 本地连接 static 110.1.1.150 255.0.0.0 110.1.1.1 
netsh interface ip set address local static 110.1.1.150 255.0.0.0 110.1.1.1


1. 设置IP,子网掩码,网关:
netsh interface ip set address 本 static 202.121.24.37 255.255.255.0 202.121.24.1 
   其中,也可以写成 “本地连接”,要是英文操作系统恐怕要写作 “local”。 202.121.24.37 是IP地址,  255.255.255.0 为子网掩码,202.121.24.1 是网关。

2. 设置DNS和备用DNS:
netsh interface ip set dns 本 static 202.121.20.100
   设置备用DNS,需要把 set 换成 add ,同时将 static 去掉:

  netsh int ip add dns 本 202.121.20.200


example:

ip=110.1.1.111

netsh interface ip set address 本地连接 static  110.1.1.111  255.0.0.0  110.1.1.1
@netsh interface ip set dns 本地连接 110.1.1.88


ip=192.168.1.150

netsh interface ip set address 本地连接 static 192.168.1.150  255.255.255.0  192.168.1.1
@netsh interface ip set dns 本地连接 192.168.1.1


ip自动获取

netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip set dns name="本地连接" source=dhcp