[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.34

1.34    ! jmc         1: .\"    $OpenBSD: netstat.1,v 1.33 2003/08/26 08:33:12 itojun 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.
1.29      millert    15: .\" 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    16: .\"    may be used to endorse or promote products derived from this software
                     17: .\"    without specific prior written permission.
                     18: .\"
                     19: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     20: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     21: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     22: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     23: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     24: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     25: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     26: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     27: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     28: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     29: .\" SUCH DAMAGE.
                     30: .\"
                     31: .\"    from: @(#)netstat.1     8.8 (Berkeley) 4/18/94
                     32: .\"
                     33: .Dd April 18, 1994
                     34: .Dt NETSTAT 1
1.16      aaron      35: .Os
1.1       deraadt    36: .Sh NAME
                     37: .Nm netstat
                     38: .Nd show network status
                     39: .Sh SYNOPSIS
                     40: .Nm netstat
                     41: .Op Fl Aan
                     42: .Op Fl f Ar address_family
                     43: .Op Fl M Ar core
                     44: .Op Fl N Ar system
                     45: .Nm netstat
1.31      jmc        46: .Op Fl bdgilmnqrstu
1.1       deraadt    47: .Op Fl f Ar address_family
                     48: .Op Fl M Ar core
                     49: .Op Fl N Ar system
                     50: .Nm netstat
1.24      camield    51: .Op Fl bdn
1.1       deraadt    52: .Op Fl I Ar interface
                     53: .Op Fl M Ar core
                     54: .Op Fl N Ar system
                     55: .Op Fl w Ar wait
                     56: .Nm netstat
                     57: .Op Fl M Ar core
                     58: .Op Fl N Ar system
1.31      jmc        59: .Op Fl p Ar protocol
1.19      itojun     60: .Nm netstat
1.34    ! jmc        61: .Op Fl a
1.19      itojun     62: .Op Fl f Ar address_family
1.34    ! jmc        63: .Op Fl i | I Ar interface
1.1       deraadt    64: .Sh DESCRIPTION
                     65: The
1.21      aaron      66: .Nm
1.1       deraadt    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.
1.21      aaron      71: .Pp
1.1       deraadt    72: The first form of the command displays a list of active sockets for
                     73: each protocol.
                     74: The second form presents the contents of one of the other network
                     75: data structures according to the option selected.
                     76: Using the third form, with a
                     77: .Ar wait
                     78: interval specified,
1.21      aaron      79: .Nm
1.1       deraadt    80: will continuously display the information regarding packet
                     81: traffic on the configured network interfaces.
                     82: The fourth form displays statistics about the named protocol.
1.30      jmc        83: The fifth form displays per interface statistics for
                     84: the specified address family.
1.1       deraadt    85: .Pp
1.12      aaron      86: The options are as follows:
1.22      aaron      87: .Bl -tag -width Ds
1.1       deraadt    88: .It Fl A
                     89: With the default display,
                     90: show the address of any protocol control blocks associated with sockets; used
                     91: for debugging.
                     92: .It Fl a
                     93: With the default display,
                     94: show the state of all sockets; normally sockets used by
                     95: server processes are not shown.
1.34    ! jmc        96: With the interface display (options
        !            97: .Fl I
        !            98: or
        !            99: .Fl i ) ,
        !           100: show multicast addresses.
1.24      camield   101: .It Fl b
1.34    ! jmc       102: With the interface display (options
        !           103: .Fl I
        !           104: or
1.24      camield   105: .Fl i ) ,
                    106: show bytes in and out, instead of packet statistics.
1.1       deraadt   107: .It Fl d
1.34    ! jmc       108: With either the interface display (options
        !           109: .Fl I
        !           110: or
        !           111: .Fl i )
        !           112: or an interval (option
        !           113: .Fl w ) ,
1.1       deraadt   114: show the number of dropped packets.
1.16      aaron     115: .It Fl f Ar address_family
1.1       deraadt   116: Limit statistics or address control block reports to those
                    117: of the specified
1.12      aaron     118: .Ar address_family .
1.21      aaron     119: .Pp
                    120: The following address families are recognized:
                    121: .Pp
                    122: .Bl -column "Address Family" "AF_APPLETA" "Description" -offset indent -compact
                    123: .It Sy "Address Family" Ta Sy "Constant" Ta Sy "Description"
1.32      jmc       124: .It "inet" Ta Dv "AF_INET" Ta "IP Version 4"
                    125: .It "inet6" Ta Dv "AF_INET6" Ta "IP Version 6"
                    126: .It "ipx" Ta Dv "AF_IPX" Ta "Novell IPX"
                    127: .It "atalk" Ta Dv "AF_APPLETALK" Ta "AppleTalk"
                    128: .It "ns" Ta Dv "AF_NS" Ta "Xerox NS Protocols"
                    129: .It "iso" Ta Dv "AF_ISO" Ta "ISO Protocol Family"
                    130: .It "encap" Ta Dv "PF_KEY" Ta "IPsec"
                    131: .It "local" Ta Dv "AF_LOCAL" Ta "Local to Host (i.e., pipes)"
                    132: .It "unix" Ta Dv "AF_UNIX" Ta "Local to Host (i.e., pipes)"
1.21      aaron     133: .El
                    134: .Pp
1.1       deraadt   135: .It Fl g
                    136: Show information related to multicast (group address) routing.
1.34    ! jmc       137: By default, show the IP multicast virtual-interface and routing tables.
1.1       deraadt   138: If the
                    139: .Fl s
                    140: option is also present, show multicast routing statistics.
1.16      aaron     141: .It Fl I Ar interface
1.21      aaron     142: Show information about the specified
                    143: .Ar interface ;
1.1       deraadt   144: used with a
                    145: .Ar wait
                    146: interval as described below.
1.21      aaron     147: .Pp
1.19      itojun    148: If the
1.34    ! jmc       149: .Fl a
        !           150: option is also present, multicast addresses currently in use are shown
        !           151: for the given interface and for each IP interface address.
        !           152: Multicast addresses are shown on separate lines following the interface
        !           153: address with which they are associated.
        !           154: .Pp
        !           155: If the
1.19      itojun    156: .Fl f Ar address_family
                    157: option (with the
                    158: .Fl s
1.30      jmc       159: option) is present, show per-interface
                    160: statistics on the given interface for the specified
                    161: .Ar address_family .
1.1       deraadt   162: .It Fl i
                    163: Show the state of interfaces which have been auto-configured
1.21      aaron     164: (interfaces statically configured into a system but not
                    165: located at boot-time are not shown).
                    166: .Pp
1.1       deraadt   167: If the
                    168: .Fl a
1.21      aaron     169: option is also present, multicast addresses currently in use are shown
1.1       deraadt   170: for each Ethernet interface and for each IP interface address.
                    171: Multicast addresses are shown on separate lines following the interface
                    172: address with which they are associated.
1.21      aaron     173: .Pp
1.19      itojun    174: If the
                    175: .Fl f Ar address_family
                    176: option (with the
                    177: .Fl s
1.30      jmc       178: option) is present, show per-interface statistics on all interfaces
1.21      aaron     179: for the specified
1.30      jmc       180: .Ar address_family .
1.31      jmc       181: .It Fl l
                    182: With the
                    183: .Fl g
                    184: option, display wider fields for the IPv6 multicast routing table
                    185: .Qq Origin
                    186: and
                    187: .Qq Group
                    188: columns.
1.17      deraadt   189: .It Fl M Ar core
1.1       deraadt   190: Extract values associated with the name list from the specified core
1.27      miod      191: instead of the running kernel.
1.1       deraadt   192: .It Fl m
                    193: Show statistics recorded by the memory management routines
                    194: (the network manages a private pool of memory buffers).
1.17      deraadt   195: .It Fl N Ar system
1.27      miod      196: Extract the name list from the specified system instead of the running kernel.
1.1       deraadt   197: .It Fl n
                    198: Show network addresses as numbers (normally
1.21      aaron     199: .Nm
1.1       deraadt   200: interprets addresses and attempts to display them
                    201: symbolically).
                    202: This option may be used with any of the display formats.
1.16      aaron     203: .It Fl p Ar protocol
1.1       deraadt   204: Show statistics about
1.12      aaron     205: .Ar protocol ,
1.21      aaron     206: which is either a well-known name for a protocol or an alias for it.
                    207: Some protocol names and aliases are listed in the file
1.1       deraadt   208: .Pa /etc/protocols .
                    209: A null response typically means that there are no interesting numbers to
                    210: report.
                    211: The program will complain if
                    212: .Ar protocol
                    213: is unknown or if there is no statistics routine for it.
1.26      brian     214: .It Fl q
                    215: Only show interfaces that have seen packets (or bytes if
                    216: .Fl b
1.34    ! jmc       217: is specified).
1.1       deraadt   218: .It Fl r
                    219: Show the routing tables.
1.21      aaron     220: If the
1.1       deraadt   221: .Fl s
1.21      aaron     222: option is also specified, show routing statistics instead.
1.26      brian     223: .It Fl s
                    224: Show per-protocol statistics.
                    225: If this option is repeated, counters with a value of zero are suppressed.
1.31      jmc       226: .It Fl t
                    227: With the
                    228: .Fl i
                    229: option, display the current value of the watchdog timer function.
                    230: .It Fl u
                    231: Limit statistics or address control block reports to the
                    232: .Dv AF_UNIX
                    233: address family.
1.10      peter     234: .It Fl v
1.19      itojun    235: Be verbose.
                    236: Avoids truncation of long addresses.
1.1       deraadt   237: .It Fl w Ar wait
                    238: Show network interface statistics at intervals of
                    239: .Ar wait
                    240: seconds.
                    241: .El
                    242: .Pp
                    243: The default display, for active sockets, shows the local
                    244: and remote addresses, send and receive queue sizes (in bytes), protocol,
                    245: and the internal state of the protocol.
1.21      aaron     246: .Pp
                    247: Address formats are of the form
                    248: .Dq host.port
                    249: or
                    250: .Dq network.port
1.1       deraadt   251: if a socket's address specifies a network but no specific host address.
1.21      aaron     252: When known, the host and network addresses are displayed symbolically
                    253: according to the databases
1.1       deraadt   254: .Pa /etc/hosts
                    255: and
                    256: .Pa /etc/networks ,
1.21      aaron     257: respectively.
                    258: If a symbolic name for an address is unknown, or if the
1.1       deraadt   259: .Fl n
                    260: option is specified, the address is printed numerically, according
                    261: to the address family.
1.21      aaron     262: .Pp
                    263: For more information regarding the Internet
                    264: .Dq dot format ,
1.1       deraadt   265: refer to
1.12      aaron     266: .Xr inet 3 .
1.34    ! jmc       267: Unspecified or
1.21      aaron     268: .Dq wildcard
                    269: addresses and ports appear as a single
1.34    ! jmc       270: .Sq * .
1.6       deraadt   271: If a local port number is registered as being in use for RPC by
1.12      aaron     272: .Xr portmap 8 ,
1.11      aaron     273: its RPC service name or RPC service number will be printed in
1.21      aaron     274: .Dq []
                    275: immediately after the port number.
1.1       deraadt   276: .Pp
                    277: The interface display provides a table of cumulative
                    278: statistics regarding packets transferred, errors, and collisions.
                    279: The network addresses of the interface
1.21      aaron     280: and the maximum transmission unit (MTU) are also displayed.
1.1       deraadt   281: .Pp
1.21      aaron     282: The routing table display indicates the available routes and their status.
                    283: Each route consists of a destination host or network and
                    284: a gateway to use in forwarding packets.
                    285: If the destination is a
                    286: network in numeric format, the netmask (in /24 style format) is appended.
                    287: The flags field shows a collection of information about
                    288: the route stored as binary choices.
                    289: The individual flags are discussed in more detail in the
1.1       deraadt   290: .Xr route 8
                    291: and
                    292: .Xr route 4
                    293: manual pages.
1.21      aaron     294: .Pp
1.1       deraadt   295: The mapping between letters and flags is:
                    296: .Bl -column XXXX RTF_BLACKHOLE
1.12      aaron     297: 1      RTF_PROTO1      Protocol specific routing flag #1.
                    298: 2      RTF_PROTO2      Protocol specific routing flag #2.
1.25      niklas    299: 3      RTF_PROTO3      Protocol specific routing flag #3.
1.16      aaron     300: B      RTF_BLACKHOLE   Just discard pkts (during updates).
1.12      aaron     301: C      RTF_CLONING     Generate new routes on use.
1.34    ! jmc       302: c      RTF_CLONED      Cloned routes (generated from RTF_CLONING).
1.12      aaron     303: D      RTF_DYNAMIC     Created dynamically (by redirect).
                    304: G      RTF_GATEWAY     Destination requires forwarding by intermediary.
                    305: H      RTF_HOST        Host entry (net otherwise).
1.1       deraadt   306: L      RTF_LLINFO      Valid protocol to link address translation.
1.12      aaron     307: M      RTF_MODIFIED    Modified dynamically (by redirect).
                    308: R      RTF_REJECT      Host or net unreachable.
                    309: S      RTF_STATIC      Manually added.
                    310: U      RTF_UP  Route usable.
                    311: X      RTF_XRESOLVE    External daemon translates proto to link address.
1.1       deraadt   312: .El
                    313: .Pp
1.21      aaron     314: Direct routes are created for each interface attached to the local host;
1.1       deraadt   315: the gateway field for such entries shows the address of the outgoing interface.
1.21      aaron     316: The refcnt field gives the current number of active uses of the route.
                    317: Connection oriented protocols normally hold on to a single route for the
                    318: duration of a connection while connectionless protocols obtain a route while
                    319: sending to the same destination.
                    320: The use field provides a count of the number of packets sent using that route.
                    321: The MTU entry shows the MTU associated with that route.
                    322: This MTU value is used as the basis for the TCP maximum segment size (MSS).
1.34    ! jmc       323: The
        !           324: .Sq L
        !           325: flag appended to the MTU value indicates that the value is
        !           326: locked, and that path MTU discovery is turned off for that route.
1.21      aaron     327: A
1.1       deraadt   328: .Sq -
1.12      aaron     329: indicates that the MTU for this route has not been set, and a default
1.21      aaron     330: TCP maximum segment size will be used.
                    331: The interface entry indicates the network interface utilized for the route.
1.1       deraadt   332: .Pp
                    333: When
1.21      aaron     334: .Nm
1.1       deraadt   335: is invoked with the
                    336: .Fl w
                    337: option and a
                    338: .Ar wait
                    339: interval argument, it displays a running count of statistics related to
                    340: network interfaces.
                    341: An obsolescent version of this option used a numeric parameter
                    342: with no option, and is currently supported for backward compatibility.
                    343: This display consists of a column for the primary interface (the first
                    344: interface found during autoconfiguration) and a column summarizing
                    345: information for all interfaces.
                    346: The primary interface may be replaced with another interface with the
                    347: .Fl I
                    348: option.
                    349: The first line of each screen of information contains a summary since the
1.21      aaron     350: system was last rebooted.
                    351: Subsequent lines of output show values accumulated over the preceding interval.
1.1       deraadt   352: .Sh SEE ALSO
                    353: .Xr nfsstat 1 ,
                    354: .Xr ps 1 ,
1.34    ! jmc       355: .Xr inet 3 ,
1.21      aaron     356: .Xr netintro 4 ,
1.34    ! jmc       357: .Xr route 4 ,
1.1       deraadt   358: .Xr hosts 5 ,
                    359: .Xr networks 5 ,
                    360: .Xr protocols 5 ,
                    361: .Xr services 5 ,
1.15      alex      362: .Xr iostat 8 ,
1.34    ! jmc       363: .Xr portmap 8 ,
        !           364: .Xr route 8 ,
1.1       deraadt   365: .Xr trpt 8 ,
                    366: .Xr vmstat 8
                    367: .Sh HISTORY
                    368: The
1.21      aaron     369: .Nm
1.1       deraadt   370: command appeared in
                    371: .Bx 4.2 .
1.19      itojun    372: IPv6 support was added by WIDE/KAME project.
1.1       deraadt   373: .Sh BUGS
                    374: The notion of errors is ill-defined.