当前位置: 移动技术网 > IT编程>网络>Dos/Bat > 使用批处理命令设置windows系统的ip地址和dns附图

使用批处理命令设置windows系统的ip地址和dns附图

2017年12月08日  | 移动技术网IT编程  | 我要评论
找到对应的网卡名称 使用命令:ipconfig 复制代码 代码如下: ipconfig/all windows ip configuration host name . .
找到对应的网卡名称

使用命令:ipconfig
复制代码 代码如下:

ipconfig/all

windows ip configuration

host name . . . . . . . . . . . . : d501-4-3
primary dns suffix . . . . . . . :
node type . . . . . . . . . . . . : unknown
ip routing enabled. . . . . . . . : no
wins proxy enabled. . . . . . . . : no

ethernet adapter 本地连接:

connection-specific dns suffix . :
description . . . . . . . . . . . : marvell yukon 88e8057 pci-e gigabit
ethernet controller
physical address. . . . . . . . . : 44-37-e6-1d-5b-f1
dhcp enabled. . . . . . . . . . . : no
ip address. . . . . . . . . . . . : 192.168.1.111
subnet mask . . . . . . . . . . . : 255.255.255.0
default gateway . . . . . . . . . : 192.168.1.1
dns servers . . . . . . . . . . . : 8.8.8.8

我们现在需要设置的网卡名称为"本地连接",ip地址为192.168.1.111,子网掩码为255.255.255.0,dns地址为8.8.8.8

将ip和dns设置为自动获取

使用命令:
netsh interface ip set address "本地连接" dhcp
netsh interface ip set dns "本地连接" dhcp

复制代码 代码如下:

netsh interface ip set address "本地连接" dhcp
确定。

netsh interface ip set dns "本地连接" dhcp
确定。

相当于操作:
 

将ip和dns设置为固定的值

使用命令:
netsh interface ip set address "本地连接" static [ip地址] [子网掩码] [网关] [网关跳远点数:一般填1]
netsh interface ip set dns "本地连接" static [dns地址]
复制代码 代码如下:

netsh interface ip set address "本地连接" static 192.168.1.111 255.255.255.0 192
.168.1.1 1
确定。

netsh interface ip set dns "本地连接" static 8.8.8.8
确定。

相当于操作:

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网