tahoe only
[unix-history] / usr / src / usr.bin / netstat / netstat.1
CommitLineData
93874d5d
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
57d17fbd 5.\" @(#)netstat.1 6.6 (Berkeley) %G%
93874d5d 6.\"
b8edfa5e 7.TH NETSTAT 1 ""
93874d5d
KM
8.UC 5
9.SH NAME
10netstat \- show network status
11.SH SYNOPSIS
12.B netstat
13[
84efacbd 14.B \-Aan
93874d5d 15] [
114898a7
KS
16.B \-f
17.I address_family
18] [
84efacbd 19.I system
93874d5d 20] [
84efacbd
MK
21.I core
22]
23.br
24.B netstat
25[
26.B \-himnrs
93874d5d 27] [
84efacbd
MK
28.B \-f
29.I address_family
93874d5d
KM
30] [
31.I system
32] [
33.I core
34]
84efacbd
MK
35.br
36.B netstat
37[
38.B \-n
39] [
40.B \-I
41.I interface
42]
43.I interval
44[
45.I system
46] [
47.I core
48]
57d17fbd
MK
49.br
50.B netstat
51[
52.B \-p
53.I protocol
54] [
55.I system
56] [
57.I core
58]
93874d5d
KM
59.SH DESCRIPTION
60The
61.I netstat
62command symbolically displays the contents of various network-related
84efacbd
MK
63data structures.
64There are a number of output formats,
65depending on the options for the information presented.
66The first form of the command displays a list of active sockets for
67each protocol.
68The second form presents the contents of one of the other network
69data structures according to the option selected.
70Using the third form, with an
71.I interval
72specified,
73.I netstat
74will continuously display the information regarding packet
75traffic on the configured network interfaces.
57d17fbd 76The fourth form displays statistics about the named protocol.
84efacbd
MK
77.PP
78The options have the following meaning:
93874d5d
KM
79.TP
80.B \-A
84efacbd
MK
81With the default display,
82show the address of any protocol control blocks associated with sockets; used
83for debugging.
93874d5d
KM
84.TP
85.B \-a
84efacbd 86With the default display,
93874d5d 87show the state of all sockets; normally sockets used by
84efacbd 88server processes are not shown.
93874d5d
KM
89.TP
90.B \-h
84efacbd 91Show the state of the IMP host table.
93874d5d
KM
92.TP
93.B \-i
84efacbd 94Show the state of interfaces which have been auto-configured
93874d5d 95(interfaces statically configured into a system, but not
84efacbd 96located at boot time are not shown).
93874d5d 97.TP
b8edfa5e 98.BI \-I " interface"
84efacbd
MK
99Show information only about this interface;
100used with an
b8edfa5e 101.I interval
84efacbd 102as described below.
b8edfa5e 103.TP
93874d5d 104.B \-m
84efacbd
MK
105Show statistics recorded by the memory management routines
106(the network manages a private pool of memory buffers).
93874d5d
KM
107.TP
108.B \-n
84efacbd 109Show network addresses as numbers (normally
93874d5d
KM
110.I netstat
111interprets addresses and attempts to display them
84efacbd
MK
112symbolically).
113This option may be used with any of the display formats.
93874d5d 114.TP
57d17fbd
MK
115.BI \-p " protocol"
116Show statistics about
117.IR protocol ,
118which is either a well-known name for a protocol or an alias for it. Some
119protocol names and aliases are listed in the file
120.IR /etc/protocols .
121A null response typically means that there are no interesting numbers to
122report.
123The program will complain if
124.I protocol
125is unknown or if there is no statistics routine for it.
126.TP
93874d5d 127.B \-s
84efacbd 128Show per-protocol statistics.
93874d5d
KM
129.TP
130.B \-r
84efacbd
MK
131Show the routing tables.
132When
133.B \-s
134is also present, show routing statistics instead.
114898a7
KS
135.TP
136.BI \-f " address_family"
84efacbd 137Limit statistics or address control block reports to those
114898a7
KS
138of the specified
139.IR address\ family .
84efacbd
MK
140The following address families
141are recognized:
114898a7
KS
142.IR inet ,
143for
84efacbd 144.BR AF_INET ,
114898a7
KS
145.IR ns ,
146for
84efacbd
MK
147.BR AF_NS ,
148and
149.IR unix ,
150for
151.BR AF_UNIX .
93874d5d
KM
152.PP
153The arguments,
154.I system
155and
156.I core
157allow substitutes for the defaults ``/vmunix'' and ``/dev/kmem''.
158.PP
84efacbd 159The default display, for active sockets, shows the local
93874d5d 160and remote addresses, send and receive queue sizes (in bytes), protocol,
84efacbd 161and the internal state of the protocol.
93874d5d
KM
162Address formats are of the form ``host.port'' or ``network.port''
163if a socket's address specifies a network but no specific host address.
164When known the host and network addresses are displayed symbolically
165according to the data bases
166.I /etc/hosts
167and
168.IR /etc/networks ,
169respectively. If a symbolic name for an address is unknown, or if
170the
171.B \-n
84efacbd
MK
172option is specified, the address is printed numerically, according
173to the address family.
174For more information regarding
175the Internet ``dot format,''
93874d5d 176refer to
84efacbd 177.IR inet (3N).
93874d5d
KM
178Unspecified,
179or ``wildcard'', addresses and ports appear as ``*''.
180.PP
181The interface display provides a table of cumulative
182statistics regarding packets transferred, errors, and collisions.
84efacbd 183The network addresses of the interface
93874d5d
KM
184and the maximum transmission unit (``mtu'') are also displayed.
185.PP
186The routing table display indicates the available routes and
187their status. Each route consists of a destination host or network
188and a gateway to use in forwarding packets. The flags field shows
84efacbd
MK
189the state of the route (``U'' if ``up''), whether the route
190is to a gateway (``G''), and whether the route was created dynamically
191by a redirect (``D''). Direct routes are created for each
192interface attached to the local host;
193the gateway field for such entries shows the address of the outgoing interface.
194The refcnt field gives the
93874d5d
KM
195current number of active uses of the route. Connection oriented
196protocols normally hold on to a single route for the duration of
84efacbd
MK
197a connection while connectionless protocols obtain a route while sending
198to the same destination.
199The use field provides a count of the number of packets
93874d5d
KM
200sent using that route. The interface entry indicates the network
201interface utilized for the route.
202.PP
203When
204.I netstat
205is invoked with an
206.I interval
207argument, it displays a running count of statistics related to
84efacbd
MK
208network interfaces. This display consists of a
209column for the primary interface
210(the first interface found during autoconfiguration)
211and a column summarizing
212information for all interfaces.
213The primary interface may be replaced with another interface with the
214.I \-I
215option.
216The first line of each screen of information contains a summary since the
93874d5d
KM
217system was last rebooted. Subsequent lines of output show values
218accumulated over the preceding interval.
219.SH SEE ALSO
220iostat(1),
221vmstat(1),
222hosts(5),
223networks(5),
224protocols(5),
225services(5),
226trpt(8C)
227.SH BUGS
228The notion of errors is ill-defined. Collisions mean
229something else for the IMP.