自动快速设置IP

由于机器常常 要切换网络,频繁的改IP 非常麻烦。利用windows 的netsh 命令可以快速设置IP!!!
1、IP、子网掩码、网关
设置IP为自动获取:
netsh interface ip set address "本地连接" dhcp

设置IP及子网掩码:
netsh interface ip set address "本地连接" source=static addr=192.168.2.66 mask=255.255.255.0

设置网关:
netsh interface ip set address "本地连接" gateway=192.168.2.1 gwmetric=0


2、dns
设置自动获取dns
netsh interface ip set dns name="本地连接" source=dhcp
设置主DNS:
netsh interface ip set dns "本地连接" source=static addr=221.207.58.58 register=PRIMARY

设置备用DNS:
netsh interface ip add dns "本地连接" addr=202.116.128.2 index=2

猜你喜欢

转载自ileson.iteye.com/blog/1056458