IP相关

≯℡__Kan透↙ 提交于 2021-01-15 16:15:31

1. Rename a Network Interface from the Command Line

netsh interface ip show interfaces
netsh interface set interface name = "Local Area Connection 5" newname = "iSCSI1"

2. Configure IP/GW/DNS

Set IP/GW:
netsh interface ip show interfaces
netsh interface ip set address "Ethernet0 2" source=static 10.24.101.19 255.255.0.0 10.24.255.254

Set DNS:
netsh interface ip set dnsservers "Ethernet0 2" static 10.110.1.13

Add second DNS:
netsh interface ip add dnsservers "Ethernet0 2" 10.110.1.14

Add second IP:
netsh interface ip add address "Ethernet0 2" 10.24.101.18 255.255.0.0

3. Disable IPv6 Using PowerShell

Get-NetAdapterBinding -ComponentID ms_tcpip6
Disable-NetAdapterBinding -Name "Ethernet0 2" -ComponentID ms_tcpip6

You can use the wildcard * to disable IPv6 on all network adapters, instead of disabling them one by one.

Disable-NetAdapterBinding -Name "*" -ComponentID ms_tcpip6

Whenever you need to enable IPv6 again, just run this command:

Enable-NetAdapterBinding -name * -ComponentID ms_tcpip6

4. Run powershell script with CMD

Powershell.exe -noexit "& ""c:\temp\aa.ps1"""

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!