次の方法で共有


Netstat (Compact 2013)

3/26/2014

The netstat command-line tool displays active TCP/IP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for the IPv4, ICMP, TCP, and UDP protocols), and IPv6 statistics (for the IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols).

Syntax

netstat [-?] [-e] [-n] [-p proto] [-s] [-r] [-d] [interval]

Options

The following table describes each netstat option. These options are not case-sensitive.

Option

Option

Description

-?

Displays information about available netstat options.

-e

Displays Ethernet statistics, such as the number of bytes and packets sent and received over the Ethernet connection.

-n

Displays IP addresses and port numbers in numerical form.

-p

proto

Shows connections for the protocol specified by proto; proto may be any one of: TCP, UDP, TCPv6, or UDPv6. If you use -p with the -s option to display per-protocol statistics, you have more protocol options. In this case, proto may be any of: IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6. When you specify IP, netstat displays IPv4 statistics.

-s

Displays per-protocol statistics. By default, statistics are shown for IPv4, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6.

-r

Displays the contents of the IP routing table.

-d

Prints output to the debug output port. If your device is connected to Platform Builder, netstat prints to the Output window in Visual Studio.

interval

Redisplays selected statistics, pausing for the number of seconds specified by interval between each display. Press CTRL+C to stop redisplaying statistics. If interval is omitted, netstat will print the current configuration information once.

Remarks

When you use the netstat command-line tool, you can prefix command options with a hyphen (-) or a slash (/).

The following table shows the items for which netstat provides statistics.

Item

Description

Proto

The name of the protocol (IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6).

Local Address

The IP address of the local computer and the port number being used. The name of the local computer that corresponds to the IP address and the name of the port is shown unless the -n parameter is specified. If the port is not yet established, the port number is shown as an asterisk (*).

Foreign Address

The IP address and port number of the remote computer to which the socket is connected. The names that correspond to the IP address and the port are shown unless the -n parameter is specified. If the port is not yet established, the port number is shown as an asterisk (*).

(state)

Indicates the state of a TCP connection. The possible states are shown in the following table.

StateExplanation
CLOSEDThe connection is closed.
LISTENWaiting for a connection request from any remote client and port.
SYN_RCVDWaiting for a confirming connection request acknowledgement after having both received and sent a connection request.
SYN_SENTWaiting for a matching connection request after having sent a connection request.
ESTABAn open connection is established. Data can be transferred over the connection.
FIN_WAIT1Waiting for a connection termination request from the remote side of the connection, or an acknowledgement of a connection request previously sent.
CLOSE_WAITWaiting for a connection termination request from the local application.
LAST_ACKWaiting for an acknowledgement of a connection termination request previously sent to the remote side of the connection.
TIME_WAITWaiting for enough time to pass to be certain that the remote side of a closing connection received acknowledgement of the connection termination request.

For more information about the states of a TCP connection, see RFC 793.

Example

To display the statistics for only the TCP protocol, type the following command:

netstat -s -p tcp

The following example shows typical output when displaying only TCP protocol statistics:

TCP Statistics:
--------------
Active Opens            = 0
Passive Opens           = 0
Connect Attempt Fails   = 0
Reset Connections       = 0
Current Connections     = 0
Segments Received       = 0
Segments Sent           = 0
Segments Retransmitted  = 0
Errors Received         = 0
Sgmnts sent w/Reset Flag= 0
Cumulative Connections  = 0
Time-Out Algorithm      = 3
Time-Out Minimim        = 10
Time-Out Maximum        = 4294967295
Maximum Connections     = Dynamic (-1)

To display both the Ethernet statistics and the statistics for all protocols, type the following command:

netstat -e -s

The following example shows the extensive output that results when you display Ethernet statistics and the statistics for all protocols:

     Interface Statistics   Received       Sent
                    Bytes    6629204      33813
          Unicast Packets         86         75
       NonUnicast Packets      18412         32
                 Discards          0          0
                   Errors          0          0
        Unknown Protocols          0 
 Name                  ={39B1F5DF-5218-97C8-9527-7C82FDB131C5}
 Index                 =2 
 Physical Address      =0003FFA5CA8E 
 Description           =VMINI1
 Type                  =6
 Mtu                   =1500
 Speed - bps           =1000000 
 Administrative Status =1 
 Operational Status    =5
 Output Queue Length   =0 

     Interface Statistics   Received       Sent
                    Bytes          0          0
          Unicast Packets          0          0
       NonUnicast Packets          0          0
                 Discards          0          0
                   Errors          0          0
        Unknown Protocols          0 
 Name                  ={1B4747B7-54D1-0AFD-8130-73354FB72A47}
 Index                 =3 
 Physical Address      =204153594EFF 
 Description           =ASYNCMAC1
 Type                  =23
 Mtu                   =1502
 Speed - bps           =1073741824 
 Administrative Status =1 
 Operational Status    =5
 Output Queue Length   =0 

     Interface Statistics   Received       Sent
                    Bytes          0          0
          Unicast Packets          0          0
       NonUnicast Packets          0          0
                 Discards          0          0
                   Errors          0          0
        Unknown Protocols          0 
 Name                  ={0E271EC4-EEC2-251F-9472-11A78A0A25BE}
 Index                 =4 
 Physical Address      =505054503030 
 Description           =PPTP1
 Type                  =23
 Mtu                   =0
 Speed - bps           =1073741824 
 Administrative Status =1 
 Operational Status    =5
 Output Queue Length   =0 

TCP6 Statistics:
--------------
Active Opens            = 0
Passive Opens           = 0
Connect Attempt Fails   = 0
Reset Connections       = 0
Current Connections     = 0
Segments Received       = 0
Segments Sent           = 0
Segments Retransmitted  = 0
Errors Received         = 0
Sgmnts sent w/Reset Flag= 0
Cumulative Connections  = 0
Time-Out Algorithm      = 3
Time-Out Minimum        = 10
Time-Out Maximum        = 4294967295
Maximum Connections     = Dynamic (-1)

TCP Statistics:
--------------
Active Opens            = 0
Passive Opens           = 0
Connect Attempt Fails   = 0
Reset Connections       = 0
Current Connections     = 0
Segments Received       = 0
Segments Sent           = 0
Segments Retransmitted  = 0
Errors Received         = 0
Sgmnts sent w/Reset Flag= 0
Cumulative Connections  = 0
Time-Out Algorithm      = 3
Time-Out Minimum        = 10
Time-Out Maximum        = 4294967295
Maximum Connections     = Dynamic (-1)

UDP6 Statistics:
--------------
Datagrams Received  = 0
No Ports            = 0
Receive Errors      = 0
Datagrams Sent      = 0
Number UDP entries  = 0

UDP Statistics:
--------------
Datagrams Received  = 1432
No Ports            = 6607
Receive Errors      = 0
Datagrams Sent      = 2
Number UDP entries  = 2

IP6 Statistics:
--------------
Packets Received            = 32
Received Header Errors      = 0
Received Address Errors     = 0
Datagrams Forwarded         = 0
Unknown Protocols Received  = 0
Received Packets Discarded  = 0
Received Packets Delivered  = 32
Output Requests             = 13
Routing Discards            = 0
Discarded Output Packets    = 0
Output Packet No Route      = 0
Reassembly Required         = 0
Reassembly Successful       = 0
Reassembly Failures         = 0
Datagrams Fragmented OK     = 0
Datagrams Fragmented Fail   = 0
Fragments Created           = 0
DefaultTTL                  = 128
Datagrams All Frgs Not Rcvd = 60
Number of Interfaces        = 2
Number of Addresses         = 6
Number of Routes in Table   = 4
Forwarding Enabled          = 2

IP Statistics:
--------------
Packets Received            = 8277
Received Header Errors      = 0
Received Address Errors     = 230
Datagrams Forwarded         = 0
Unknown Protocols Received  = 0
Received Packets Discarded  = 6607
Received Packets Delivered  = 1442
Output Requests             = 77
Routing Discards            = 0
Discarded Output Packets    = 0
Output Packet No Route      = 0
Reassembly Required         = 0
Reassembly Successful       = 0
Reassembly Failures         = 0
Datagrams Fragmented OK     = 0
Datagrams Fragmented Fail   = 0
Fragments Created           = 0
DefaultTTL                  = 128
Datagrams All Frgs Not Rcvd = 60
Number of Interfaces        = 2
Number of Addresses         = 8
Number of Routes in Table   = 9
Forwarding Enabled          = 2

         ICMP6 Statistics   Received       Sent
          ---------------     ------     ------
                 Messages         32          8
                   Errors          0          0
  Destination Unreachable          0          0
           Packet Too Big          0          0
            Time Exceeded          0          0
            Param Problem          0          0
             Echo Request          0          0
               Echo Reply          0          0
         Membership Query          0          0
        Membership report          0          0
     Membership reduction          0          0
      Router Solicitation          0          6
     Router Advertisement         31          0
    Neighbor Solicitation          0          2
   Neighbor Advertisement          1          0
                 Redirect          0          0

          ICMP Statistics   Received       Sent
          ---------------     ------     ------
                 Messages          3         75
                   Errors          0          0
  Destination Unreachable          0         72
            Time Exceeded          0          0
       Parameter Problems          0          0
          Source Quenches          0          0
                Redirects          0          0
                   Echoes          0          3
             Echo Replies          3          0
               Timestamps          0          0
        Timestamp Replies          0          0
            Address Masks          0          0
     Address Mask Replies          0          0

See Also

Reference

Network Command-Line Tools Reference

Concepts

Network Command-Line Tools Catalog Items and Sysgen Variables