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