Annotation of src/usr.bin/netstat/netstat.1, Revision 1.2
1.2 ! deraadt 1: .\" $OpenBSD: netstat.1,v 1.11 1995/10/03 21:42:43 thorpej Exp $
1.1 deraadt 2: .\" $NetBSD: netstat.1,v 1.11 1995/10/03 21:42:43 thorpej Exp $
3: .\"
4: .\" Copyright (c) 1983, 1990, 1992, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" Redistribution and use in source and binary forms, with or without
8: .\" modification, are permitted provided that the following conditions
9: .\" are met:
10: .\" 1. Redistributions of source code must retain the above copyright
11: .\" notice, this list of conditions and the following disclaimer.
12: .\" 2. Redistributions in binary form must reproduce the above copyright
13: .\" notice, this list of conditions and the following disclaimer in the
14: .\" documentation and/or other materials provided with the distribution.
15: .\" 3. All advertising materials mentioning features or use of this software
16: .\" must display the following acknowledgement:
17: .\" This product includes software developed by the University of
18: .\" California, Berkeley and its contributors.
19: .\" 4. Neither the name of the University nor the names of its contributors
20: .\" may be used to endorse or promote products derived from this software
21: .\" without specific prior written permission.
22: .\"
23: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33: .\" SUCH DAMAGE.
34: .\"
35: .\" from: @(#)netstat.1 8.8 (Berkeley) 4/18/94
36: .\"
37: .Dd April 18, 1994
38: .Dt NETSTAT 1
39: .Os BSD 4.2
40: .Sh NAME
41: .Nm netstat
42: .Nd show network status
43: .Sh SYNOPSIS
44: .Nm netstat
45: .Op Fl Aan
46: .Op Fl f Ar address_family
47: .Op Fl M Ar core
48: .Op Fl N Ar system
49: .Nm netstat
50: .Op Fl dghimnrs
51: .Op Fl f Ar address_family
52: .Op Fl M Ar core
53: .Op Fl N Ar system
54: .Nm netstat
55: .Op Fl dn
56: .Op Fl I Ar interface
57: .Op Fl M Ar core
58: .Op Fl N Ar system
59: .Op Fl w Ar wait
60: .Nm netstat
61: .Op Fl p Ar protocol
62: .Op Fl M Ar core
63: .Op Fl N Ar system
64: .Sh DESCRIPTION
65: The
66: .Nm netstat
67: command symbolically displays the contents of various network-related
68: data structures.
69: There are a number of output formats,
70: depending on the options for the information presented.
71: The first form of the command displays a list of active sockets for
72: each protocol.
73: The second form presents the contents of one of the other network
74: data structures according to the option selected.
75: Using the third form, with a
76: .Ar wait
77: interval specified,
78: .Nm netstat
79: will continuously display the information regarding packet
80: traffic on the configured network interfaces.
81: The fourth form displays statistics about the named protocol.
82: .Pp
83: The options have the following meaning:
84: .Bl -tag -width flag
85: .It Fl A
86: With the default display,
87: show the address of any protocol control blocks associated with sockets; used
88: for debugging.
89: .It Fl a
90: With the default display,
91: show the state of all sockets; normally sockets used by
92: server processes are not shown.
93: .It Fl d
94: With either interface display (option
95: .Fl i
96: or an interval, as described below),
97: show the number of dropped packets.
98: .It Fl f Ar address_family
99: Limit statistics or address control block reports to those
100: of the specified
101: .Ar address family .
102: The following address families
103: are recognized:
104: .Ar inet ,
105: for
106: .Dv AF_INET ,
107: .Ar ns ,
108: for
109: .Dv AF_NS ,
110: .Ar iso ,
111: for
112: .Dv AF_ISO ,
113: and
114: .Ar unix ,
115: for
116: .Dv AF_UNIX .
117: .It Fl g
118: Show information related to multicast (group address) routing.
119: By default, show the IP Multicast virtual-interface and routing tables.
120: If the
121: .Fl s
122: option is also present, show multicast routing statistics.
123: .It Fl h
124: Show the state of the
125: .Tn IMP
126: host table (obsolete).
127: .It Fl I Ar interface
128: Show information about the specified interface;
129: used with a
130: .Ar wait
131: interval as described below.
132: .It Fl i
133: Show the state of interfaces which have been auto-configured
134: (interfaces statically configured into a system, but not
135: located at boot time are not shown).
136: If the
137: .Fl a
138: options is also present, multicast addresses currently in use are shown
139: for each Ethernet interface and for each IP interface address.
140: Multicast addresses are shown on separate lines following the interface
141: address with which they are associated.
142: .It Fl M
143: Extract values associated with the name list from the specified core
144: instead of the default
145: .Pa /dev/kmem .
146: .It Fl m
147: Show statistics recorded by the memory management routines
148: (the network manages a private pool of memory buffers).
149: .It Fl N
150: Extract the name list from the specified system instead of the default
151: .Pa /netbsd .
152: .It Fl n
153: Show network addresses as numbers (normally
154: .Nm netstat
155: interprets addresses and attempts to display them
156: symbolically).
157: This option may be used with any of the display formats.
158: .It Fl p Ar protocol
159: Show statistics about
160: .Ar protocol ,
161: which is either a well-known name for a protocol or an alias for it. Some
162: protocol names and aliases are listed in the file
163: .Pa /etc/protocols .
164: A null response typically means that there are no interesting numbers to
165: report.
166: The program will complain if
167: .Ar protocol
168: is unknown or if there is no statistics routine for it.
169: .It Fl s
170: Show per-protocol statistics.
171: If this option is repeated, counters with a value of zero are suppressed.
172: .It Fl r
173: Show the routing tables.
174: When
175: .Fl s
176: is also present, show routing statistics instead.
177: .It Fl w Ar wait
178: Show network interface statistics at intervals of
179: .Ar wait
180: seconds.
181: .El
182: .Pp
183: The default display, for active sockets, shows the local
184: and remote addresses, send and receive queue sizes (in bytes), protocol,
185: and the internal state of the protocol.
186: Address formats are of the form ``host.port'' or ``network.port''
187: if a socket's address specifies a network but no specific host address.
188: When known the host and network addresses are displayed symbolically
189: according to the data bases
190: .Pa /etc/hosts
191: and
192: .Pa /etc/networks ,
193: respectively. If a symbolic name for an address is unknown, or if
194: the
195: .Fl n
196: option is specified, the address is printed numerically, according
197: to the address family.
198: For more information regarding
199: the Internet ``dot format,''
200: refer to
201: .Xr inet 3 ) .
202: Unspecified,
203: or ``wildcard'', addresses and ports appear as ``*''.
204: .Pp
205: The interface display provides a table of cumulative
206: statistics regarding packets transferred, errors, and collisions.
207: The network addresses of the interface
208: and the maximum transmission unit (``mtu'') are also displayed.
209: .Pp
210: The routing table display indicates the available routes and
211: their status. Each route consists of a destination host or network
212: and a gateway to use in forwarding packets. The flags field shows
213: a collection of information about the route stored as
214: binary choices. The individual flags are discussed in more
215: detail in the
216: .Xr route 8
217: and
218: .Xr route 4
219: manual pages.
220: The mapping between letters and flags is:
221: .Bl -column XXXX RTF_BLACKHOLE
222: 1 RTF_PROTO2 Protocol specific routing flag #1
223: 2 RTF_PROTO1 Protocol specific routing flag #2
224: B RTF_BLACKHOLE Just discard pkts (during updates)
225: C RTF_CLONING Generate new routes on use
226: D RTF_DYNAMIC Created dynamically (by redirect)
227: G RTF_GATEWAY Destination requires forwarding by intermediary
228: H RTF_HOST Host entry (net otherwise)
229: L RTF_LLINFO Valid protocol to link address translation.
230: M RTF_MODIFIED Modified dynamically (by redirect)
231: R RTF_REJECT Host or net unreachable
232: S RTF_STATIC Manually added
233: U RTF_UP Route usable
234: X RTF_XRESOLVE External daemon translates proto to link address
235: .El
236: .Pp
237: Direct routes are created for each
238: interface attached to the local host;
239: the gateway field for such entries shows the address of the outgoing interface.
240: The refcnt field gives the
241: current number of active uses of the route. Connection oriented
242: protocols normally hold on to a single route for the duration of
243: a connection while connectionless protocols obtain a route while sending
244: to the same destination.
245: The use field provides a count of the number of packets
246: sent using that route. The mtu entry shows the mtu associated with
247: that route. This mtu value is used as the basis for the TCP maximum
248: segment size. A
249: .Sq -
250: indicates that the mtu for this route has not been set, and a default
251: TCP maximum segment size will be used. The interface entry indicates
252: the network interface utilized for the route.
253: .Pp
254: When
255: .Nm netstat
256: is invoked with the
257: .Fl w
258: option and a
259: .Ar wait
260: interval argument, it displays a running count of statistics related to
261: network interfaces.
262: An obsolescent version of this option used a numeric parameter
263: with no option, and is currently supported for backward compatibility.
264: This display consists of a column for the primary interface (the first
265: interface found during autoconfiguration) and a column summarizing
266: information for all interfaces.
267: The primary interface may be replaced with another interface with the
268: .Fl I
269: option.
270: The first line of each screen of information contains a summary since the
271: system was last rebooted. Subsequent lines of output show values
272: accumulated over the preceding interval.
273: .Sh SEE ALSO
274: .Xr nfsstat 1 ,
275: .Xr ps 1 ,
276: .Xr hosts 5 ,
277: .Xr networks 5 ,
278: .Xr protocols 5 ,
279: .Xr services 5 ,
280: .Xr trpt 8 ,
281: .Xr trsp 8 ,
282: .Xr iostat 8 ,
283: .Xr vmstat 8
284: .Sh HISTORY
285: The
286: .Nm netstat
287: command appeared in
288: .Bx 4.2 .
289: .\" .Sh FILES
290: .\" .Bl -tag -width /dev/kmem -compact
291: .\" .It Pa /netbsd
292: .\" default kernel namelist
293: .\" .It Pa /dev/kmem
294: .\" default memory file
295: .\" .El
296: .Sh BUGS
297: The notion of errors is ill-defined.