1、打开Powershell 或在CMD下进入netsh/powershell
2、在netsh interface ip/ipv4 add/delete 设置有线网络或以太网IP,dns,route
3、查看网卡network Adapter 状态
实例1,Powershell 添加静态IP:
#参考命令
PS C:\Windows\system32> <strong>netsh interface ipv4
Usage: add address [name=]<string>
[[address=]<IPv4 address>[/<integer> [[mask=]<IPv4 mask>]]
[[type=]unicast|anycast]]
[[gateway=]<IPv4 address> [gwmetric=]<integer>]
[[validlifetime=]<integer>|infinite]
[[preferredlifetime=]<integer>|infinite]
[[subinterface=]<string>]
[[store=]active|persistent]
[[skipassource=]true|false]
Examples:
add address "Wired Ethernet Connection" 10.0.0.2 255.0.0.0
add address "Wired Ethernet Connection" gateway=10.0.0.3 gwmetric=2
The first command adds a static IP address of 10.0.0.2 with a subnet
mask of 255.0.0.0 to the Wired Ethernet Connection interface. The second
command adds the IP address of 10.0.0.3 as a second default gateway
for this interface with a gateway metric of 2.
#具体应用:
PS C:\Windows\system32><strong> netsh interface ipv4 add address "AP" 192.168.1.1
#检查配置
PS C:\Windows\system32> netsh interface ip show add
Configuration for interface "AP"
DHCP enabled: No
<strong>IP Address: 192.168.1.1 </strong>
Subnet Prefix: 192.168.1.0/24 (mask 255.255.255.0)
IP Address: 192.168.99.11
Subnet Prefix: 192.168.99.0/24 (mask 255.255.255.0)
InterfaceMetric: 20
实例2,删除添加的IP地址:
#参考命令
PS C:\Windows\system32> <strong>netsh interface ipv4 delete
Usage: delete address [name=]<string> [[address=]<IPv4 address>]