This diagnostic command displays protocol statistics and current TCP/IP network connections.
Syntax
netstat [-a] [-e][-n][-s] [-p protocol] [-r] [interval]
Parameters
-a
Displays all connections and listening ports; server connections are usually not shown.
-e
Displays Ethernet statistics. This can be combined with the -s option.
-n
Displays addresses and port numbers in numerical form (rather than attempting name lookups).
-s
Displays per-protocol statistics. By default, statistics are shown for TCP, UDP, ICMP, and IP; the -p option can be used to specify a subset of the default.
-p protocol
Shows connections for the protocol specified by proto; proto (See notes) can be tcp or udp. If used with the -s option to display per-protocol statistics, protocol can be tcp, udp, icmp, or ip.
-r
Displays the contents of the routing table.
interval
Redisplays selected statistics, pausing interval seconds between each display. Press Ctrl+C to stop redisplaying statistics. If this parameter is omitted, netstat prints the current configuration information once.
Notes
The netstat utility provides statistics on the following network components.
Statistic | Purpose | |
Foreign Address | The IP address and port number of the remote computer to which the socket is connected. The name corresponding to the IP address is shown, instead of the number, if the HOSTS file contains an entry for the IP address. In cases where the port is not yet established, the port number is shown as an asterisk (*). | |
Local Address | The IP address of the local computer, as well as the port number the connection is using. The name corresponding to the IP address is shown, instead of the number, if the HOSTS file contains an entry for the IP address. In cases where the port is not yet established, the port number is shown as an asterisk (*). | |
Proto | The name of the protocol used by the connection. | |
(state) | Indicates the state of TCP connections only. The possible states are: CLOSED FIN_WAIT_1 SYN_RECEIVED CLOSE_WAIT FIN_WAIT_2 SYN_SEND ESTABLISHED LISTEN TIMED_WAIT LAST_ACK |