Name

netstat

Synopsis

Displays statistics and current connections for TCP/IP.

Syntax

netstat [-a] [-e] [-n] [-s] [-p protocol] [-r] [interval]

Options

-a

Lists all TCP/IP connections and their current statuses.

-e

Displays frame statistics for network adapters (can be used with -s option).

-n

Lists addresses and port numbers as numbers instead of trying to resolve them using DNS. This is useful if DNS isn’t working properly and you want to avoid long timeouts when using netstat.

-p protocol

When used in conjunction with -s option, displays statistics for the specified protocol, which can be either TCP, UDP, ICMP, or IP.

-r

Displays the routing table.

-s

Displays statistics and connections for all TCP/IP protocols.

interval

Causes the output to be refreshed every interval seconds until Ctrl-C is pressed.

Examples

Show statistics for Ethernet frames:

                     netstat -e
Interface Statistics
                           Received            Sent
Bytes                      48446148        43795441
Unicast packets              195267          207067
Non-unicast packets           12311            6830
Discards                          0               0
Errors                            0               0
Unknown protocols             15400

Show statistics for TCP protocol and the current state of TCP connections:

                     netstat -s -p tcp TCP Statistics Active Opens = 7631 Passive Opens = 4689 Failed Connection Attempts = 269 Reset Connections = 380 Current Connections = 23 Segments Received = 160892 Segments Sent = 173884 Segments Retransmitted = 680 Active Connections Proto Local Address Foreign Address State TCP test:ldap test.mtitcanada.com:4208 ESTABLISHED TCP test:ldap test.mtitcanada.com:4216 ESTABLISHED ...

Get Windows 2000 Administration in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.