分享免费的编程资源和教程

网站首页 > 技术教程 正文

掌握ipconfig、netstat、tracert和pathping命令

goqiw 2024-09-18 14:54:55 技术教程 25 ℃ 0 评论

大家好,我是 网络系统技艺者,点击右上方“关注”,每天和大家分享 关于 网络设备及系统和企业组网 方面干货。码字不易,如果您觉得文章还可以,就点赞+关注+收藏吧,也许在以后某个时间能够用得到。

ipconfig 命令

ipconfig 命令用于显示、释放和更新 Windows 操作系统中网络适配器的 IP 地址。它提供了有关当前网络配置的详细信息。

1. ipconfig /all

显示所有网络适配器的详细配置信息,包括物理地址 (MAC 地址)、IP 地址、子网掩码、默认网关、DHCP 状态和 DNS 服务器等。

ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : MyComputer
   Primary Dns Suffix  . . . . . . . : mydomain.local
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : mydomain.local
   Description . . . . . . . . . . . : Intel(R) Ethernet Connection
   Physical Address. . . . . . . . . : 00-AA-BB-CC-DD-EE
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 192.168.1.100
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DNS Servers . . . . . . . . . . . : 192.168.1.1
                                      8.8.8.8

2. ipconfig /release

释放当前网络适配器的 IP 地址。这将使网络适配器断开与 DHCP 服务器的连接并释放其 IP 地址。

用法:

ipconfig /release

Windows IP Configuration

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : mydomain.local
   Description . . . . . . . . . . . : Intel(R) Ethernet Connection
   Physical Address. . . . . . . . . : 00-AA-BB-CC-DD-EE
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 192.168.1.100 (Preferred)
   Lease Expires . . . . . . . . . . : Friday, June 19, 2024 1:00:00 PM
   Lease Obtained . . . . . . . . . .: Friday, June 19, 2024 12:00:00 PM

3. ipconfig /renew

从 DHCP 服务器请求新的 IP 地址。该命令用于更新 IP 地址,通常在 ipconfig /release 之后使用。

用法:

ipconfig /renew

Windows IP Configuration

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : mydomain.local
   Description . . . . . . . . . . . : Intel(R) Ethernet Connection
   Physical Address. . . . . . . . . : 00-AA-BB-CC-DD-EE
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 192.168.1.101
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DNS Servers . . . . . . . . . . . : 192.168.1.1
                                      8.8.8.8

netstat 命令

netstat 命令用于显示网络连接、路由表和网络接口的统计信息。

1. netstat -a

显示所有活动的网络连接和监听端口。

用法:

netstat -a

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING
  TCP    0.0.0.0:443            0.0.0.0:0              LISTENING
  TCP    192.168.1.100:51584    93.184.216.34:80       ESTABLISHED
  UDP    0.0.0.0:123            *:*
  UDP    192.168.1.100:137      *:*
  UDP    192.168.1.100:138      *:*

2. netstat -e

显示以太网统计信息,例如字节和数据包的传输和接收数量。

用法:

netstat -e

Interface Statistics

                           Received            Sent

Bytes                       12345678           23456789
Unicast packets             12345              67890
Non-unicast packets         123                456
Discards                    0                  0
Errors                      0                  0
Unknown protocols           0

3. netstat -r

显示路由表信息。

用法:

netstat -r

===========================================================================
Interface List
  1...00-aa-bb-cc-dd-ee ......Intel(R) Ethernet Connection
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.1    192.168.1.100     10
        127.0.0.0        255.0.0.0        127.0.0.1        127.0.0.1     1
      192.168.1.0    255.255.255.0      192.168.1.1    192.168.1.100     10
===========================================================================
Persistent Routes:
  None

tracert 命令

tracert 命令用于显示数据包从源到目的地所经过的路径(路由)。

用法:

tracert <hostname_or_ip>
tracert 223.5.5.5

pathping 命令

pathping 命令结合了 ping 和 tracert 的功能,显示从源到目的地经过每个路由器的详细信息,并提供每个路由器的延迟和丢包率。

用法:

pathping <hostname_or_ip>

  C:\Users\>pathping 223.5.5.5

通过最多 30 个跃点跟踪
到 public1.alidns.com [223.5.5.5] 的路由:
  0  DESKTOP-CDEC4LS [192.168.6.11]
  1     *        *        *
正在计算统计信息,已耗时 0 秒...
            指向此处的源   此节点/链接
跃点  RTT    已丢失/已发送 = Pct  已丢失/已发送 = Pct  地址
  0                                           DESKTOP-CDEC4LS [192.168.6.11]

跟踪完成。

作者简介:

我是“网络系统技艺者”,系统运维工程师一枚,持续分享【网络技术+系统运维技术】干货。码字不易,如果您觉得文章还可以,就关注+收藏吧,也许在以后某个时间能够用得到。

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表