Windows Netstat命令教程

  • Post author:
  • Post category:其他


Netstat is used to display active TCP connections and related listening ports in the computer or system. Actually, there are more features provided by

netstat

like display statistics about network stack protocols, IPv4, IPv6, TCP, UDP, etc.

Netstat用于显示计算机或系统中的活动TCP连接和相关的侦听端口。 实际上,

netstat

提供了更多功能,例如有关网络堆栈协议,IPv4,IPv6,TCP,UDP等的显示统计信息。

netstat命令语法

(

netstat Command Syntax

)

The syntax of the netstat command is like below. Simply we can use the following options.

netstat命令的语法如下。 只需我们可以使用以下选项。

netstat OPTIONS
  • OPTIONS will set different options and arguments about the netstat command behavior.

    选项将设置有关netstat命令行为的不同选项和参数。

显示带有侦听端口的所有TCP和UDP连接

(

Display All TCP and UDP Connections with Listening Ports

)

TCP is the most used protocol for the transmission of packets between different hosts. In a regular usage for a host, there will be a lot of TCP connections in different phases. We can display all these connections with

-a

option like below.

TCP是在不同主机之间传输数据包最常用的协议。 在主机的常规用法中,在不同阶段中将有许多TCP连接。 我们可以使用

-a

选项显示所有这些连接,如下所示。

> netstat -a
Display All TCP Connections
Display All TCP Connections
显示所有TCP连接

We can see that while listing listening ports following information about these ports is provided.

我们可以看到,在列出侦听端口时,提供了有关这些端口的信息。


  • Proto

    is the protocol the listening port is running. Generally, TCP and UDP are used.


    Proto

    是侦听端口正在运行的协议。 通常,使用TCP和UDP。


  • Local Address

    is the local or current system IP address and ports number. The IP address and the port number are delimited with the

    :

    .

    0.0.0.0

    means all local IP addresses or network interfaces where

    127.0.0.1

    means only localhost or current system.


    Local Address

    是本地或当前系统的IP地址和端口号。 IP地址和端口号以

    :

    分隔。

    0.0.0.0

    表示所有本地IP地址或网络接口,其中

    127.0.0.1

    表示仅本地主机或当前系统。


  • Foreign Address

    is the remote IP address which is initiated a connection. Like Local address, IP address and the port number are delimited with the

    :

    .


    Foreign Address

    是发起连接的远程IP地址。 像本地地址一样,IP地址和端口号用

    :

    分隔。


  • State

    will provide the current status of the given port. A port can be listening which means accepting connections or

    CLOSED

    recently closed etc. More details about the port or TCP states can be found below.


    State

    将提供给定端口的当前状态。 端口可能正在侦听,这意味着接受连接或最近关闭的

    CLOSED

    等。有关端口或TCP状态的更多详细信息,请参见下面的内容。

netstat命令的TCP状态

(

TCP States for netstat Command

)

As we know TCP protocol provides reliable data transfer between hosts. TCP implements sessions to provide this reliability. From start to end there are different states in a TCP session. Here the sequence and meaning of TCP states.

众所周知,TCP协议可在主机之间提供可靠的数据传输。 TCP实现会话以提供这种可靠性。 从头到尾,TCP会话中有不同的状态。 这里是TCP状态的顺序和含义。


  • LISTENING

    means the port is listening but do not have any connection with a remote host


    LISTENING

    表示该端口正在侦听,但与远程主机没有任何连接


  • ESTABLISHED

    the connection established and communicating with the remote host


    ESTABLISHED

    连接并与远程主机通信


  • TIME_WAIT

    the connection is in a wait situations


    TIME_WAIT

    连接处于等待状态


  • CLOSE_WAIT

    the connection is the closing phase


    CLOSE_WAIT

    连接处于关闭阶段


  • CLOSED

    the connection is closed


    CLOSED

    连接已关闭


  • SYN_RECEIVED

    the

    sync

    flag received to start the connection


    SYN_RECEIVED

    收到

    sync

    标志以开始连接

LEARN MORE  How To Start, Stop, Restart Networking On Linux?