O'Reilly logo

Windows Server 2003 in a Nutshell by Mitch Tulloch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

-o

Displays process ID associated with each listening port.

-s

Displays statistics and connections for all TCP/IP protocols.

-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.

interval

Causes the output to be refreshed each specified number of 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required