龙空技术网

Windows系统CMD命令提示符的常用命令汇总第6期-Netsh

onme0 231

前言:

此刻你们对“windows netsh”大约比较珍视,大家都需要剖析一些“windows netsh”的相关内容。那么小编也在网络上汇集了一些对于“windows netsh””的相关文章,希望朋友们能喜欢,你们一起来学习一下吧!

概述

Windows系统Netsh是一种命令行脚本工具,利用它可查看或修改当前正在运行的计算机的网络配置。例如,使用它查询网卡相关的信息,如IP地址、DNS、TCP连接和UDP连接等信息、导出系统网卡的配置文件、修改系统原始的网卡名、根据网卡名禁用和启用网卡、修改网卡的IP地址信息等。

那么,该如何利用它实现上述的需求,本期文章予以揭晓。

查看系统网卡相关信息系统网卡的状态及网卡名称

通过命令“netsh interface show interface”可查看系统网卡的状态及网卡名称;

如下图所示,通过命令“netsh interface ip show”可查看系统网卡IPv4的地址配置信息、DNS信息、路由信息和TCP连接信息等。

同理,通过命令“netsh interface ipv6 show”查看系统网卡IPv6的相关信息。

查看IP地址配置信息

netsh interface ip show addresses

查看DNS服务器地址

netsh interface ip show dns

查看系统网卡的Idx和MTU值

netsh interface ip show interface

查看系统TCP连接信息

netsh interface ip show tcpconn

导出系统网卡的配置文件

#导出系统网卡配置文件;

在系统命令提示符中,输入命令以下命令,

C:\>netsh -c dump interface >D:\netsh\IP2024

修改系统原始的网卡名

netsh interface set interface name="Ethernet0" newname="New业务"

根据网卡名禁用和启用网卡

#禁用网卡"New业务"

netsh interface set interface "New业务" disabled

#启用网卡"New业务"

netsh interface set interface "New业务" enable

修改网卡的IP地址信息

#系统网卡"New业务"配置静态IP:192.168.1.2,掩码:255.255.255.0,网关IP:192.168.1.10

方式1:

netsh interface ip set address name="New业务" source=static address=192.168.1.2 mask=255.255.255.0 gateway=192.168.1.10

【推荐】方式2:

netsh interface ip set address "New业务" static 192.168.1.2 255.255.255.0 192.168.1.10

#系统网卡"New业务"配置静态DNS是233.5.5.5

方式1:

netsh interface ip set dns name="New业务" source=static addr=223.5.5.5 register=primary

【推荐】方式2:

netsh interface ip set dns "New业务" static 223.6.5.5 primary

#系统网卡"New业务"配置自动获取IP

netsh interface ip set address "New业务" dhcp

#系统网卡"New业务"配置自动获取DNS

netsh interface ip set dns "New业务" dhcp

查看无线网卡配置文件及相应SSID的密码

#查看已连接的无线网络的名称

netsh wlan show profile

#查看特定无线网络的密码

netsh wlan show profile name="昊空3楼" key=clear

系统防火墙管理

#查看系统防火墙的状态

netsh advfirewall show all state

#开启系统防火墙功能

netsh advfirewall set allprofiles state on

#禁用系统防火墙功能

netsh advfirewall set allprofiles state off

总结

以上分享,希望各位小伙伴有所收获,欢迎各位点赞、收藏和指正。

标签: #windows netsh