Dos命令更改IP地址、网关、DNS

【批处理设置静态IP】********** 复制以下内容保存为bat
netsh interface ip set address name="本地连接" source = static addr = 192.168.8.231 mask=255.255.0.0
netsh interface ip set address name="本地连接" gateway = 192.168.8.1 gwmetric =0
netsh interface ip set dns name="本地连接" source = static addr = 202.96.128.143 register=PRIMARY
netsh interface ip add dns name="本地连接" addr = 202.96.128.186 index=2

 

【批处理自动获取IP】********** 复制以下内容保存为bat
netsh interface IP set address name="本地连接" source=dhcp
netsh interface ip set dns name="本地连接" source=dhcp

1、更改静态IP地址:

命令:etsh interface ip set address "本地连接" static  IP  掩码  网关  跃点数

如: netsh interface ip set address "本地连接" static 192.168.0.10 255.255.255.0 192.168.0.1

2、更改DNS:

命令:netsh   iterface ip set dns "本地连接" static DNS地址 pimary

如:netsh interface ip set dns   "本地连接"   static 202.96.128.143   primary

 

posted @ 2008-09-26 21:00  月亮不合眼  阅读(1857)  评论(1编辑  收藏  举报