常用网络命令
netshell
命令行设置DNS
netsh interface ip set dns wlan static 223.6.6.6
netsh interface ip set dns wlan dhcp
命令行设置IP地址
netsh interface ip set address wlan dhcp
netsh interface ip set address wlan static 192.168.50.8 255.255.254.0 192.168.50.1
命令行设置DNS
netsh interface ip set dns wlan static 8.8.8.8 //设置DNS
netsh interface ip add dns wlan 8.8.8.8 2 //添加备用dns
powershell
Get-NetAdapter //获取网卡信息
Get-NetIPInterface //获取网卡状态
Restart-NetAdapter -Name wlan //重启网卡
Get-DnsClientServerAddress //获取DNS信息
Get-DnsClientServerAddress wlan //获取指定网卡DNS信息
Get-DnsClientCache //获取dns缓存
Clear-DnsClientCache //清除DNS缓存
#设置dns
Set-DnsClientServerAddress wlan -ServerAddresses 223.5.5.5
Set-DnsClientServerAddress -InterfaceAlias wlan -ServerAddresses 223.6.6.6,223.5.5.5,2400:3200::1,2400:3200:baba::1
#设置ip地址命令
Get-NetIPConfiguration //获取ip地址信息
Get-NetIPConfiguration -InterfaceAlias wlan //获取指定网卡ip地址信息
Set-NetIPInterface -Dhcp enable -InterfaceAlias wlan //设置网卡自动获取ip
Remove-NetIPAddress -ifindex 8 //删除8号网卡的ip地址
//给8号网卡添加一个ip地址
New-NetIPAddress -InterfaceIndex 8 -IPAddress 192.168.50.240 -DefaultGateway 192.168.50.1 -PrefixLength 24
//删除8号网卡上的一个ip地址
Remove-NetIPAddress -intefaceIndex 8 -IPAddress 192.168.50.241
Set-NetIPAddress #修改ip地址信息掩码
Set-NetIPAddress -InterfaceIndex 8 -PrefixLength 25
发表评论 取消回复