This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / usr.bin / netstat / netstat.1
CommitLineData
15637ed4
RG
1.\" Copyright (c) 1983, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)netstat.1 6.14 (Berkeley) 7/27/91
33.\"
34.Dd July 27, 1991
35.Dt NETSTAT 1
36.Os BSD 4.2
37.Sh NAME
38.Nm netstat
39.Nd show network status
40.Sh SYNOPSIS
41.Nm netstat
42.Op Fl Aan
43.Op Fl f Ar address_family
44.Op Ar system
45.Op Ar core
46.Nm netstat
47.Op Fl himnrs
48.Op Fl f Ar address_family
49.Op Fl M Ar core
50.Op Fl N Ar system
51.Nm netstat
52.Op Fl n
53.Op Fl I Op Ar interface
54.Op Fl M Ar core
55.Op Fl N Ar system
56.Op Fl w Ar wait
57.Nm netstat
58.Op Fl p Ar protocol
59.Op Fl M Ar core
60.Op Fl N Ar system
61.Sh DESCRIPTION
62The
63.Nm netstat
64command symbolically displays the contents of various network-related
65data structures.
66There are a number of output formats,
67depending on the options for the information presented.
68The first form of the command displays a list of active sockets for
69each protocol.
70The second form presents the contents of one of the other network
71data structures according to the option selected.
72Using the third form, with a
73.Ar wait
74interval specified,
75.Nm netstat
76will continuously display the information regarding packet
77traffic on the configured network interfaces.
78The fourth form displays statistics about the named protocol.
79.Pp
80The options have the following meaning:
81.Bl -tag -width flag
82.It Fl A
83With the default display,
84show the address of any protocol control blocks associated with sockets; used
85for debugging.
86.It Fl a
87With the default display,
88show the state of all sockets; normally sockets used by
89server processes are not shown.
90.It Fl d
91With either interface display (option
92.Fl i
93or an interval, as described below),
94show the number of dropped packets.
95.It Fl h
96Show the state of the
97.Tn IMP
98host table.
99.It Fl i
100Show the state of interfaces which have been auto-configured
101(interfaces statically configured into a system, but not
102located at boot time are not shown).
103.It Fl I Ar interface
104Show information only about this interface;
105used with an
106.Ar wait
107interval as described below.
108.It Fl M
109Extract values associated with the name list from the specified core
110instead of the default
111.Pa /dev/kmem .
112.It Fl m
113Show statistics recorded by the memory management routines
114(the network manages a private pool of memory buffers).
115.It Fl N
116Extract the name list from the specified system instead of the default
117.Pa /vmunix .
118.It Fl n
119Show network addresses as numbers (normally
120.Nm netstat
121interprets addresses and attempts to display them
122symbolically).
123This option may be used with any of the display formats.
124.It Fl p Ar protocol
125Show statistics about
126.Ar protocol ,
127which is either a well-known name for a protocol or an alias for it. Some
128protocol names and aliases are listed in the file
129.Pa /etc/protocols .
130A null response typically means that there are no interesting numbers to
131report.
132The program will complain if
133.Ar protocol
134is unknown or if there is no statistics routine for it.
135.It Fl s
136Show per-protocol statistics.
137.It Fl r
138Show the routing tables.
139When
140.Fl s
141is also present, show routing statistics instead.
142.It Fl f Ar address_family
143Limit statistics or address control block reports to those
144of the specified
145.Ar address family .
146The following address families
147are recognized:
148.Ar inet ,
149for
150.Dv AF_INET ,
151.Ar ns ,
152for
153.Dv AF_NS ,
154and
155.Ar unix ,
156for
157.Dv AF_UNIX .
158.El
159.Pp
160The default display, for active sockets, shows the local
161and remote addresses, send and receive queue sizes (in bytes), protocol,
162and the internal state of the protocol.
163Address formats are of the form ``host.port'' or ``network.port''
164if a socket's address specifies a network but no specific host address.
165When known the host and network addresses are displayed symbolically
166according to the data bases
167.Pa /etc/hosts
168and
169.Pa /etc/networks ,
170respectively. If a symbolic name for an address is unknown, or if
171the
172.Fl n
173option is specified, the address is printed numerically, according
174to the address family.
175For more information regarding
176the Internet ``dot format,''
177refer to
178.Xr inet 3 ) .
179Unspecified,
180or ``wildcard'', addresses and ports appear as ``*''.
181.Pp
182The interface display provides a table of cumulative
183statistics regarding packets transferred, errors, and collisions.
184The network addresses of the interface
185and the maximum transmission unit (``mtu'') are also displayed.
186.Pp
187The routing table display indicates the available routes and
188their status. Each route consists of a destination host or network
189and a gateway to use in forwarding packets. The flags field shows
190the state of the route (``U'' if ``up''), whether the route
191is to a gateway (``G''), whether the route was created dynamically
192by a redirect (``D''), and whether the route has been modified
193by a redirect (``M''). Direct routes are created for each
194interface attached to the local host;
195the gateway field for such entries shows the address of the outgoing interface.
196The refcnt field gives the
197current number of active uses of the route. Connection oriented
198protocols normally hold on to a single route for the duration of
199a connection while connectionless protocols obtain a route while sending
200to the same destination.
201The use field provides a count of the number of packets
202sent using that route. The interface entry indicates the network
203interface utilized for the route.
204.Pp
205When
206.Nm netstat
207is invoked with a
208.Ar wait
209interval argument, it displays a running count of statistics related to
210network interfaces.
211This display consists of a column for the primary interface (the first
212interface found during autoconfiguration) and a column summarizing
213information for all interfaces.
214The primary interface may be replaced with another interface with the
215.Fl I
216option.
217The first line of each screen of information contains a summary since the
218system was last rebooted. Subsequent lines of output show values
219accumulated over the preceding interval.
220.Sh SEE ALSO
221.Xr iostat 1 ,
222.Xr nfsstat 1 ,
223.Xr ps 1 ,
224.Xr vmstat 1 ,
225.Xr hosts 5 ,
226.Xr networks 5 ,
227.Xr protocols 5 ,
228.Xr services 5 ,
229.Xr trpt 8 ,
230.Xr trsp 8
231.Sh HISTORY
232The
233.Nm netstat
234command appeared in
235.Bx 4.2 .
236.\" .Sh FILES
237.\" .Bl -tag -width /dev/kmem -compact
238.\" .It Pa /vmunix
239.\" default kernel namelist
240.\" .It Pa /dev/kmem
241.\" default memory file
242.\" .El
243.Sh BUGS
244The notion of errors is ill-defined.
245.Pp
246Collisions mean something else for the
247.Tn IMP .