NETSH 命令

  1. Interface

Interface

设置 IP 地址。

add
delete
dump
help
ip
add
dns [name=]<string> [addr=]<IP address> [[index=]integer]
address [name=]<string> [[addr=]IP address [mask=]IP subnet mask] [[gateway=]IP address [gwmetric=]integer]
wins [name=]<string> [addr=]<IP address> [[index=]integer]
delete
dump
help
set
address [name=]... [source=]... [gateway=]... [gwmetric=]...
[name=]"本地连接"
[source=]
static [addr=]IP地址 [mask=]掩码
dhcp
[gateway=]网关IP
[gateway=]none
[gwmetric=]网关跃点数一般为1
address [name=]"本地连接" dhcp 网关IP 1
show
reset
set
show

示例:

功能 语法
设置IP Netsh interface IP Set Address "本地连接" Static 192.168.1.2 255.255.255.0 192.168.1.1 1
添加IP netsh interface ip add address "本地连接" 192.168.1.3 255.255.255.0
设置DNS netsh interface IP set dns "本地连接" static 192.168.1.1
添加DNS netsh interface IP add dns "本地连接" 192.168.1.3