在命令提示符(cmd)中,可以使用ipconfig /all查看本机所有网络适配器的详细配置信息。在Windows操作系统中,使用命令提示符(CMD)查看网络连接是一种高效且直接的方法,下面将详细介绍如何通过CMD查看网络连接,包括具体步骤、相关命令和示例输出结果。
一、使用ipconfig命令查看网络适配器的详细配置信息
1、功能:显示所有网络适配器的详细配置信息,包括IP地址、子网掩码、默认网关和MAC地址等。
2、示例:ipconfig /all
3、输出结果:
Windows IP 配置
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . : example.com
Link-local IPv6 Address . . . . . : fe80::d9e7:bff:fe2e:9c5b%12
IPv4 Address. . . . . . . . . . . . . : 192.168.1.2
Subnet Mask . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
DHCP Server . . . . . . . . . . : 192.168.1.1
DNS Servers . . . . . . . . . . : 8.8.8.8
8.8.4.4
Ethernet adapter Wi-Fi:
Connection-specific DNS Suffix . : example.com
Link-local IPv6 Address . . . . . : fe80::d9e7:bff:fe2e:9c5b%12
IPv4 Address. . . . . . . . . . : 192.168.0.3
Subnet Mask . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
DHCP Server . . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . : 8.8.8.8
8.8.4.4二、使用netstat命令查看当前活动的TCP连接和监听端口
1、功能:显示所有活动的TCP连接和监听端口。
2、示例:netstat -an
3、输出结果:
Proto Local Address Foreign Address State
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
TCP 192.168.1.2:139 0.0.0.0:0 LISTENING
TCP 192.168.1.2:443 10.0.0.1:54321 ESTABLISHED
TCP 192.168.1.2:1025 192.168.1.3:445 CLOSE_WAIT
...三、使用ping命令测试网络连接状态1、功能:通过发送ICMP数据包到指定的目标地址,测试网络连接状态。
2、示例:ping www.google.com
3、输出结果:
Pinging google.com [74.125.224.72] with 32 bytes of data:
Reply from 74.125.224.72: bytes=32 time=28ms TTL=54
Reply from 72.14.232.3: bytes=32 time=27ms TTL=54
Reply from 72.14.232.3: bytes=32 time=26ms TTL=54
Reply from 72.14.232.3: bytes=32 time=27ms TTL=54
Ping statistics for 72.14.232.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 26ms, Maximum = 28ms, Average = 27ms四、使用netsh命令查看网络接口的类型和连接状态
1、功能:显示所有网络接口的类型和连接状态。
2、示例:netsh interface show interface
3、输出结果:
Administrative State Descriptive State Physical/Link State
Enabled Connected Connected
Enabled Connected Connected五、使用PowerShell命令查看网络接口的状态和连接类型
1、功能:使用PowerShell的Get-NetAdaptercmdlet来查看网络接口的状态和连接类型。
2、示例:Get-NetAdapter
3、输出结果:
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
-----------------------------------------------------------------------------------------------------
Ethernet ... ... Up ... ... Gbps
Wi-Fi ... ... Up ... ... Mbps六、使用tracert命令跟踪数据包到达目标的路径
1、功能:跟踪数据包到达目标的路径。
2、示例:tracert www.google.com
3、输出结果:
Tracing route to google.com [74.125.224.72] over a maximum of 25 hops:
1 <1 ms <1 ms <1 mms ...
2 ... ... ...
... ... ... ...七、使用nslookup命令查询DNS以获取域名或IP映射
1、功能:查询DNS以获取域名或IP映射。
2、示例:nslookup www.baidu.com
3、输出结果:
Server: UnKnown
Address: xxx.xxx.xxx.xxx
Non-authoritative answer:
Name: www.baidu.com
Addresses: x.x.x.x, x.x.x.x, x.x.x.x, x.x.x.x八、使用netstat命令过滤已建立的连接
1、功能:显示所有已建立的连接。
2、示例:netstat -a | findstr "ESTABLISHED"
3、输出结果:
Proto Local Address Foreign Address State
TCP 192.168.1.2:443 10.0.0.1:54321 ESTABLISHED九、使用netstat命令过滤特定应用程序的连接记录
1、功能:过滤特定应用程序的连接记录。
2、示例:netstat -a | findstr "应用程序名称"
3、输出结果:
Proto Local Address Foreign Address State
TCP 192.168.1.2:1025 192.168.1.3:445 CLOSE_WAIT十、使用netstat命令查看更详细的网络连接历史记录
1、功能:查看更详细的网络连接历史记录,包括连接的开始时间、持续时间等信息。
2、示例:netstat -e -s | findstr "时间段" /i
3、输出结果:
...
Datagrams Received = xxxxxxx
Datagrams Sent = xxxxxxx
Unicast packets sent = xxxxxxx
Nonunicast packets sent = xxxxxxx
Discards = xxxxxxx
...十一、使用netstat命令过滤特定时间段内的连接记录
1、功能:过滤特定时间段内的连接记录。
2、示例:netstat -e -s | findstr "时间段" /i
3、输出结果:
...
Datagrams Received = xxxxxxx
Datagrams Sent = xxxxxxx
Unicast packets sent = xxxxxxx
Nonunicast packets sent = xxxxxxx
Discards = xxxxxxx
...十二、使用netstat命令保存网络连接历史记录到文件
1、功能:保存网络连接历史记录到文件。
2、示例:netstat -e > network_connection_history.txt
3、输出结果:文件“network_connection_history.txt”将保存在当前目录下。
以上就是关于“cmd怎么查看网络连接”的问题,朋友们可以点击主页了解更多内容,希望可以够帮助大家!
文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/59993.html<