[BACK]Return to netstat.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / netstat

Annotation of src/usr.bin/netstat/netstat.1, Revision 1.19

1.19    ! itojun      1: .\"    $OpenBSD: netstat.1,v 1.18 1999/09/01 17:22:03 aaron 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
1.16      aaron      39: .Os
1.1       deraadt    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
1.18      aaron      50: .Op Fl dgimnrs
1.1       deraadt    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
1.19    ! itojun     64: .Nm netstat
        !            65: .Op Fl p Ar protocol
        !            66: .Op Fl i
        !            67: .Op Fl I Ar Interface
        !            68: .Nm netstat
        !            69: .Op Fl s
        !            70: .Op Fl f Ar address_family
        !            71: .Op Fl i
        !            72: .Op Fl I Ar Interface
1.1       deraadt    73: .Sh DESCRIPTION
                     74: The
                     75: .Nm netstat
                     76: command symbolically displays the contents of various network-related
                     77: data structures.
                     78: There are a number of output formats,
                     79: depending on the options for the information presented.
                     80: The first form of the command displays a list of active sockets for
                     81: each protocol.
                     82: The second form presents the contents of one of the other network
                     83: data structures according to the option selected.
                     84: Using the third form, with a
                     85: .Ar wait
                     86: interval specified,
                     87: .Nm netstat
                     88: will continuously display the information regarding packet
                     89: traffic on the configured network interfaces.
                     90: The fourth form displays statistics about the named protocol.
1.19    ! itojun     91: The fifth and sixth forms display per interface statistics for
        !            92: the specified protocol or address family.
1.1       deraadt    93: .Pp
1.12      aaron      94: The options are as follows:
1.1       deraadt    95: .Bl -tag -width flag
                     96: .It Fl A
                     97: With the default display,
                     98: show the address of any protocol control blocks associated with sockets; used
                     99: for debugging.
                    100: .It Fl a
                    101: With the default display,
                    102: show the state of all sockets; normally sockets used by
                    103: server processes are not shown.
                    104: .It Fl d
                    105: With either interface display (option
                    106: .Fl i
                    107: or an interval, as described below),
                    108: show the number of dropped packets.
1.16      aaron     109: .It Fl f Ar address_family
1.1       deraadt   110: Limit statistics or address control block reports to those
                    111: of the specified
1.12      aaron     112: .Ar address_family .
1.1       deraadt   113: The following address families
                    114: are recognized:
1.12      aaron     115: .Ar inet ,
1.1       deraadt   116: for
1.12      aaron     117: .Dv AF_INET ,
1.19    ! itojun    118: .Ar inet6 ,
        !           119: for
        !           120: .Dv AF_INET6 ,
1.4       mickey    121: .Ar ipx ,
                    122: for
1.12      aaron     123: .Dv AF_IPX ,
1.8       denny     124: .Ar atalk ,
                    125: for
                    126: .Dv AF_APPLETALK ,
1.1       deraadt   127: .Ar ns ,
                    128: for
1.12      aaron     129: .Dv AF_NS ,
1.1       deraadt   130: .Ar iso ,
                    131: for
                    132: .Dv AF_ISO ,
1.7       angelos   133: .Ar encap ,
                    134: for
1.13      angelos   135: .Dv PF_KEY ,
1.12      aaron     136: .Ar local ,
1.5       kstailey  137: for
1.12      aaron     138: .Dv AF_LOCAL ,
1.1       deraadt   139: and
1.12      aaron     140: .Ar unix ,
1.1       deraadt   141: for
1.12      aaron     142: .Dv AF_UNIX .
1.1       deraadt   143: .It Fl g
                    144: Show information related to multicast (group address) routing.
                    145: By default, show the IP Multicast virtual-interface and routing tables.
                    146: If the
                    147: .Fl s
                    148: option is also present, show multicast routing statistics.
1.16      aaron     149: .It Fl I Ar interface
1.1       deraadt   150: Show information about the specified interface;
                    151: used with a
                    152: .Ar wait
                    153: interval as described below.
1.19    ! itojun    154: If the
        !           155: .Fl f Ar address_family
        !           156: option (with the
        !           157: .Fl s
        !           158: option) or the
        !           159: .Fl p Ar protocol
        !           160: option is present, show per-interface statistics on the
        !           161: .Ar interface
        !           162: for the specfied
        !           163: .Ar address_family
        !           164: or
        !           165: .Ar protocol,
        !           166: respectively.
1.1       deraadt   167: .It Fl i
                    168: Show the state of interfaces which have been auto-configured
                    169: (interfaces statically configured into a system, but not
                    170: located at boot time are not shown).
                    171: If the
                    172: .Fl a
                    173: options is also present, multicast addresses currently in use are shown
                    174: for each Ethernet interface and for each IP interface address.
                    175: Multicast addresses are shown on separate lines following the interface
                    176: address with which they are associated.
1.19    ! itojun    177: If the
        !           178: .Fl f Ar address_family
        !           179: option (with the
        !           180: .Fl s
        !           181: option) or the
        !           182: .Fl p Ar protocol
        !           183: option is present, show per-interface statistics on all interfaces
        !           184: for the specfied
        !           185: .Ar address_family
        !           186: or
        !           187: .Ar protocol,
        !           188: respectively.
1.17      deraadt   189: .It Fl M Ar core
1.1       deraadt   190: Extract values associated with the name list from the specified core
                    191: instead of the default
                    192: .Pa /dev/kmem .
                    193: .It Fl m
                    194: Show statistics recorded by the memory management routines
                    195: (the network manages a private pool of memory buffers).
1.17      deraadt   196: .It Fl N Ar system
1.1       deraadt   197: Extract the name list from the specified system instead of the default
1.3       ccappuc   198: .Pa /bsd .
1.1       deraadt   199: .It Fl n
                    200: Show network addresses as numbers (normally
                    201: .Nm netstat
                    202: interprets addresses and attempts to display them
                    203: symbolically).
                    204: This option may be used with any of the display formats.
1.16      aaron     205: .It Fl p Ar protocol
1.1       deraadt   206: Show statistics about
1.12      aaron     207: .Ar protocol ,
1.1       deraadt   208: which is either a well-known name for a protocol or an alias for it.  Some
                    209: protocol names and aliases are listed in the file
                    210: .Pa /etc/protocols .
                    211: A null response typically means that there are no interesting numbers to
                    212: report.
                    213: The program will complain if
                    214: .Ar protocol
                    215: is unknown or if there is no statistics routine for it.
                    216: .It Fl s
                    217: Show per-protocol statistics.
                    218: If this option is repeated, counters with a value of zero are suppressed.
                    219: .It Fl r
                    220: Show the routing tables.
                    221: When
                    222: .Fl s
                    223: is also present, show routing statistics instead.
1.10      peter     224: .It Fl v
1.19    ! itojun    225: Be verbose.
        !           226: Avoids truncation of long addresses.
1.1       deraadt   227: .It Fl w Ar wait
                    228: Show network interface statistics at intervals of
                    229: .Ar wait
                    230: seconds.
                    231: .El
                    232: .Pp
                    233: The default display, for active sockets, shows the local
                    234: and remote addresses, send and receive queue sizes (in bytes), protocol,
                    235: and the internal state of the protocol.
                    236: Address formats are of the form ``host.port'' or ``network.port''
                    237: if a socket's address specifies a network but no specific host address.
                    238: When known the host and network addresses are displayed symbolically
                    239: according to the data bases
                    240: .Pa /etc/hosts
                    241: and
                    242: .Pa /etc/networks ,
                    243: respectively.  If a symbolic name for an address is unknown, or if
                    244: the
                    245: .Fl n
                    246: option is specified, the address is printed numerically, according
                    247: to the address family.
                    248: For more information regarding
                    249: the Internet ``dot format,''
                    250: refer to
1.12      aaron     251: .Xr inet 3 .
1.1       deraadt   252: Unspecified,
1.12      aaron     253: or ``wildcard'' addresses and ports appear as ``*''.
1.6       deraadt   254: If a local port number is registered as being in use for RPC by
1.12      aaron     255: .Xr portmap 8 ,
1.11      aaron     256: its RPC service name or RPC service number will be printed in
1.12      aaron     257: ``[]'' immediately after the port number.
1.1       deraadt   258: .Pp
                    259: The interface display provides a table of cumulative
                    260: statistics regarding packets transferred, errors, and collisions.
                    261: The network addresses of the interface
1.12      aaron     262: and the maximum transmission unit (``MTU'') are also displayed.
1.1       deraadt   263: .Pp
1.10      peter     264: The routing table display indicates the available routes and their
                    265: status.  Each route consists of a destination host or network and
                    266: a gateway to use in forwarding packets.  If the destination is a
                    267: network in numeric format, the netmask (in /24 style format) is
                    268: appended.  The flags field shows a collection of information about
                    269: the route stored as binary choices.  The individual flags are
                    270: discussed in more detail in the
1.1       deraadt   271: .Xr route 8
                    272: and
                    273: .Xr route 4
                    274: manual pages.
                    275: The mapping between letters and flags is:
                    276: .Bl -column XXXX RTF_BLACKHOLE
1.12      aaron     277: 1      RTF_PROTO1      Protocol specific routing flag #1.
                    278: 2      RTF_PROTO2      Protocol specific routing flag #2.
1.16      aaron     279: B      RTF_BLACKHOLE   Just discard pkts (during updates).
1.12      aaron     280: C      RTF_CLONING     Generate new routes on use.
                    281: D      RTF_DYNAMIC     Created dynamically (by redirect).
                    282: G      RTF_GATEWAY     Destination requires forwarding by intermediary.
                    283: H      RTF_HOST        Host entry (net otherwise).
1.1       deraadt   284: L      RTF_LLINFO      Valid protocol to link address translation.
1.12      aaron     285: M      RTF_MODIFIED    Modified dynamically (by redirect).
                    286: R      RTF_REJECT      Host or net unreachable.
                    287: S      RTF_STATIC      Manually added.
                    288: U      RTF_UP  Route usable.
                    289: X      RTF_XRESOLVE    External daemon translates proto to link address.
1.1       deraadt   290: .El
                    291: .Pp
                    292: Direct routes are created for each
                    293: interface attached to the local host;
                    294: the gateway field for such entries shows the address of the outgoing interface.
                    295: The refcnt field gives the
                    296: current number of active uses of the route.  Connection oriented
                    297: protocols normally hold on to a single route for the duration of
                    298: a connection while connectionless protocols obtain a route while sending
                    299: to the same destination.
                    300: The use field provides a count of the number of packets
1.12      aaron     301: sent using that route.  The MTU entry shows the MTU associated with
                    302: that route.  This MTU value is used as the basis for the TCP maximum
                    303: segment size (MSS).  A
1.1       deraadt   304: .Sq -
1.12      aaron     305: indicates that the MTU for this route has not been set, and a default
1.1       deraadt   306: TCP maximum segment size will be used.  The interface entry indicates
                    307: the network interface utilized for the route.
                    308: .Pp
                    309: When
                    310: .Nm netstat
                    311: is invoked with the
                    312: .Fl w
                    313: option and a
                    314: .Ar wait
                    315: interval argument, it displays a running count of statistics related to
                    316: network interfaces.
                    317: An obsolescent version of this option used a numeric parameter
                    318: with no option, and is currently supported for backward compatibility.
                    319: This display consists of a column for the primary interface (the first
                    320: interface found during autoconfiguration) and a column summarizing
                    321: information for all interfaces.
                    322: The primary interface may be replaced with another interface with the
                    323: .Fl I
                    324: option.
                    325: The first line of each screen of information contains a summary since the
                    326: system was last rebooted.  Subsequent lines of output show values
                    327: accumulated over the preceding interval.
                    328: .Sh SEE ALSO
                    329: .Xr nfsstat 1 ,
                    330: .Xr ps 1 ,
                    331: .Xr hosts 5 ,
                    332: .Xr networks 5 ,
                    333: .Xr protocols 5 ,
                    334: .Xr services 5 ,
1.15      alex      335: .Xr iostat 8 ,
1.1       deraadt   336: .Xr trpt 8 ,
                    337: .Xr trsp 8 ,
                    338: .Xr vmstat 8
                    339: .Sh HISTORY
                    340: The
                    341: .Nm netstat
                    342: command appeared in
                    343: .Bx 4.2 .
1.19    ! itojun    344: IPv6 support was added by WIDE/KAME project.
1.1       deraadt   345: .\" .Sh FILES
                    346: .\" .Bl -tag -width /dev/kmem -compact
1.3       ccappuc   347: .\" .It Pa /bsd
1.1       deraadt   348: .\" default kernel namelist
                    349: .\" .It Pa /dev/kmem
                    350: .\" default memory file
                    351: .\" .El
                    352: .Sh BUGS
                    353: The notion of errors is ill-defined.