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

1.68    ! tedu        1: .\"    $OpenBSD: netstat.1,v 1.67 2011/11/01 17:30:04 mikeb 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: .\"
1.68    ! tedu       33: .Dd $Mdocdate: November 1 2011 $
1.1       deraadt    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
1.63      jsing      41: .Op Fl AaBn
1.1       deraadt    42: .Op Fl f Ar address_family
1.59      blambert   43: .Op Fl p Ar protocol
1.1       deraadt    44: .Op Fl M Ar core
                     45: .Op Fl N Ar system
                     46: .Nm netstat
1.52      claudio    47: .Bk -words
1.48      pyr        48: .Op Fl bdFgilmnqrstu
1.1       deraadt    49: .Op Fl f Ar address_family
1.59      blambert   50: .Op Fl p Ar protocol
1.1       deraadt    51: .Op Fl M Ar core
                     52: .Op Fl N Ar system
1.52      claudio    53: .Op Fl T Ar tableid
                     54: .Ek
1.1       deraadt    55: .Nm netstat
1.68    ! tedu       56: .Op Fl bdhn
1.57      tedu       57: .Op Fl c Ar count
1.1       deraadt    58: .Op Fl I Ar interface
                     59: .Op Fl M Ar core
                     60: .Op Fl N Ar system
                     61: .Op Fl w Ar wait
                     62: .Nm netstat
1.61      bluhm      63: .Op Fl v
1.45      jaredy     64: .Op Fl M Ar core
                     65: .Op Fl N Ar system
                     66: .Fl P Ar pcbaddr
                     67: .Nm netstat
1.35      markus     68: .Op Fl s
1.1       deraadt    69: .Op Fl M Ar core
                     70: .Op Fl N Ar system
1.31      jmc        71: .Op Fl p Ar protocol
1.19      itojun     72: .Nm netstat
1.34      jmc        73: .Op Fl a
1.19      itojun     74: .Op Fl f Ar address_family
1.59      blambert   75: .Op Fl p Ar protocol
1.34      jmc        76: .Op Fl i | I Ar interface
1.42      reyk       77: .Nm netstat
                     78: .Op Fl W Ar interface
1.1       deraadt    79: .Sh DESCRIPTION
                     80: The
1.21      aaron      81: .Nm
1.1       deraadt    82: command symbolically displays the contents of various network-related
                     83: data structures.
                     84: There are a number of output formats,
                     85: depending on the options for the information presented.
1.21      aaron      86: .Pp
1.1       deraadt    87: The first form of the command displays a list of active sockets for
                     88: each protocol.
                     89: The second form presents the contents of one of the other network
                     90: data structures according to the option selected.
                     91: Using the third form, with a
                     92: .Ar wait
                     93: interval specified,
1.21      aaron      94: .Nm
1.1       deraadt    95: will continuously display the information regarding packet
                     96: traffic on the configured network interfaces.
1.61      bluhm      97: The fourth form displays internals of the protocol control block (PCB)
                     98: and the socket structure.
1.46      jmc        99: The fifth form displays statistics about the named protocol.
                    100: The sixth form displays per interface statistics for
1.30      jmc       101: the specified address family.
1.43      jmc       102: The final form displays per interface statistics for
                    103: the specified wireless (802.11) device.
1.1       deraadt   104: .Pp
1.12      aaron     105: The options are as follows:
1.22      aaron     106: .Bl -tag -width Ds
1.1       deraadt   107: .It Fl A
                    108: With the default display,
                    109: show the address of any protocol control blocks associated with sockets; used
1.45      jaredy    110: for debugging, e.g. with the
                    111: .Fl P
                    112: flag.
1.1       deraadt   113: .It Fl a
                    114: With the default display,
                    115: show the state of all sockets; normally sockets used by
                    116: server processes are not shown.
1.34      jmc       117: With the interface display (options
                    118: .Fl I
                    119: or
                    120: .Fl i ) ,
                    121: show multicast addresses.
1.63      jsing     122: .It Fl B
                    123: With the default display,
                    124: show buffer sizes for TCP sockets.
                    125: This includes the send window size, receive window size and congestion
                    126: window size.
1.24      camield   127: .It Fl b
1.34      jmc       128: With the interface display (options
                    129: .Fl I
                    130: or
1.24      camield   131: .Fl i ) ,
                    132: show bytes in and out, instead of packet statistics.
1.57      tedu      133: .It Fl c Ar count
                    134: Display
                    135: .Ar count
                    136: updates, then exit.
                    137: This option has no effect unless
                    138: .Fl w
                    139: is specified as well.
1.1       deraadt   140: .It Fl d
1.34      jmc       141: With either the interface display (options
                    142: .Fl I
                    143: or
                    144: .Fl i )
                    145: or an interval (option
                    146: .Fl w ) ,
1.1       deraadt   147: show the number of dropped packets.
1.48      pyr       148: .It Fl F
                    149: When showing routes, only show routes whose gateway are in the
                    150: same address family as the destination.
1.16      aaron     151: .It Fl f Ar address_family
1.1       deraadt   152: Limit statistics or address control block reports to those
                    153: of the specified
1.12      aaron     154: .Ar address_family .
1.21      aaron     155: .Pp
                    156: The following address families are recognized:
1.65      jmc       157: .Bl -column "Address Family" "AF_APPLETA" "Description" -offset indent
1.21      aaron     158: .It Sy "Address Family" Ta Sy "Constant" Ta Sy "Description"
1.55      mk        159: .It "encap" Ta Dv "PF_KEY" Ta "IPsec"
1.32      jmc       160: .It "inet" Ta Dv "AF_INET" Ta "IP Version 4"
                    161: .It "inet6" Ta Dv "AF_INET6" Ta "IP Version 6"
                    162: .It "local" Ta Dv "AF_LOCAL" Ta "Local to Host (i.e., pipes)"
1.55      mk        163: .It "mpls" Ta Dv "AF_MPLS" Ta "MPLS"
                    164: .It "pflow" Ta Dv "PF_FLOW" Ta "pflow data export"
1.32      jmc       165: .It "unix" Ta Dv "AF_UNIX" Ta "Local to Host (i.e., pipes)"
1.21      aaron     166: .El
                    167: .Pp
1.68    ! tedu      168: .It Fl h
        !           169: Use unit suffixes to reduce the number of digits shown with the
        !           170: .Fl b
        !           171: and
        !           172: .Fl w
        !           173: options.
1.1       deraadt   174: .It Fl g
                    175: Show information related to multicast (group address) routing.
1.34      jmc       176: By default, show the IP multicast virtual-interface and routing tables.
1.1       deraadt   177: If the
                    178: .Fl s
                    179: option is also present, show multicast routing statistics.
1.16      aaron     180: .It Fl I Ar interface
1.21      aaron     181: Show information about the specified
                    182: .Ar interface ;
1.1       deraadt   183: used with a
                    184: .Ar wait
                    185: interval as described below.
1.21      aaron     186: .Pp
1.19      itojun    187: If the
1.34      jmc       188: .Fl a
                    189: option is also present, multicast addresses currently in use are shown
                    190: for the given interface and for each IP interface address.
                    191: Multicast addresses are shown on separate lines following the interface
                    192: address with which they are associated.
                    193: .Pp
                    194: If the
1.19      itojun    195: .Fl f Ar address_family
                    196: option (with the
                    197: .Fl s
1.30      jmc       198: option) is present, show per-interface
                    199: statistics on the given interface for the specified
                    200: .Ar address_family .
1.1       deraadt   201: .It Fl i
                    202: Show the state of interfaces which have been auto-configured
1.21      aaron     203: (interfaces statically configured into a system but not
                    204: located at boot-time are not shown).
                    205: .Pp
1.1       deraadt   206: If the
                    207: .Fl a
1.21      aaron     208: option is also present, multicast addresses currently in use are shown
1.1       deraadt   209: for each Ethernet interface and for each IP interface address.
                    210: Multicast addresses are shown on separate lines following the interface
                    211: address with which they are associated.
1.21      aaron     212: .Pp
1.19      itojun    213: If the
                    214: .Fl f Ar address_family
                    215: option (with the
                    216: .Fl s
1.30      jmc       217: option) is present, show per-interface statistics on all interfaces
1.21      aaron     218: for the specified
1.30      jmc       219: .Ar address_family .
1.31      jmc       220: .It Fl l
                    221: With the
                    222: .Fl g
                    223: option, display wider fields for the IPv6 multicast routing table
                    224: .Qq Origin
                    225: and
                    226: .Qq Group
                    227: columns.
1.17      deraadt   228: .It Fl M Ar core
1.1       deraadt   229: Extract values associated with the name list from the specified core
1.27      miod      230: instead of the running kernel.
1.1       deraadt   231: .It Fl m
                    232: Show statistics recorded by the memory management routines
                    233: (the network manages a private pool of memory buffers).
1.17      deraadt   234: .It Fl N Ar system
1.27      miod      235: Extract the name list from the specified system instead of the running kernel.
1.1       deraadt   236: .It Fl n
                    237: Show network addresses as numbers (normally
1.21      aaron     238: .Nm
1.1       deraadt   239: interprets addresses and attempts to display them
                    240: symbolically).
                    241: This option may be used with any of the display formats.
1.45      jaredy    242: .It Fl P Ar pcbaddr
1.61      bluhm     243: Display the contents of the socket or protocol control block (PCB)
                    244: located at the kernel virtual address
1.45      jaredy    245: .Ar pcbaddr .
                    246: PCB addresses can be obtained using the
                    247: .Fl A
                    248: flag.
1.61      bluhm     249: When used with the
                    250: .Fl v
                    251: option, also print socket, domain and protocol specific structures.
1.16      aaron     252: .It Fl p Ar protocol
1.35      markus    253: Restrict the output to
1.12      aaron     254: .Ar protocol ,
1.21      aaron     255: which is either a well-known name for a protocol or an alias for it.
                    256: Some protocol names and aliases are listed in the file
1.1       deraadt   257: .Pa /etc/protocols .
                    258: The program will complain if
                    259: .Ar protocol
1.35      markus    260: is unknown.
                    261: If the
                    262: .Fl s
                    263: option is specified, the per-protocol statistics are displayed.
                    264: Otherwise the states of the matching sockets are shown.
1.26      brian     265: .It Fl q
                    266: Only show interfaces that have seen packets (or bytes if
                    267: .Fl b
1.34      jmc       268: is specified).
1.1       deraadt   269: .It Fl r
                    270: Show the routing tables.
1.21      aaron     271: If the
1.1       deraadt   272: .Fl s
1.21      aaron     273: option is also specified, show routing statistics instead.
1.60      sobrado   274: When used with the
                    275: .Fl v
                    276: option, also print routing labels.
1.26      brian     277: .It Fl s
                    278: Show per-protocol statistics.
                    279: If this option is repeated, counters with a value of zero are suppressed.
1.51      claudio   280: .It Fl T Ar tableid
1.67      mikeb     281: Select an alternate routing table to query.
                    282: The default is to use the current routing table.
1.31      jmc       283: .It Fl t
                    284: With the
                    285: .Fl i
                    286: option, display the current value of the watchdog timer function.
                    287: .It Fl u
                    288: Limit statistics or address control block reports to the
                    289: .Dv AF_UNIX
                    290: address family.
1.10      peter     291: .It Fl v
1.60      sobrado   292: Show extra (verbose) detail for the routing tables
                    293: .Pq Fl r ,
                    294: or avoid truncation of long addresses.
1.61      bluhm     295: When used with the
                    296: .Fl P
                    297: option, also print socket, domain and protocol specific structures.
1.42      reyk      298: .It Fl W Ar interface
                    299: (IEEE 802.11 devices only)
                    300: Show per-interface IEEE 802.11 wireless statistics.
1.1       deraadt   301: .It Fl w Ar wait
                    302: Show network interface statistics at intervals of
                    303: .Ar wait
                    304: seconds.
                    305: .El
                    306: .Pp
                    307: The default display, for active sockets, shows the local
                    308: and remote addresses, send and receive queue sizes (in bytes), protocol,
                    309: and the internal state of the protocol.
1.21      aaron     310: .Pp
                    311: Address formats are of the form
                    312: .Dq host.port
                    313: or
                    314: .Dq network.port
1.1       deraadt   315: if a socket's address specifies a network but no specific host address.
1.21      aaron     316: When known, the host and network addresses are displayed symbolically
                    317: according to the databases
1.1       deraadt   318: .Pa /etc/hosts
                    319: and
                    320: .Pa /etc/networks ,
1.21      aaron     321: respectively.
                    322: If a symbolic name for an address is unknown, or if the
1.1       deraadt   323: .Fl n
                    324: option is specified, the address is printed numerically, according
                    325: to the address family.
1.21      aaron     326: .Pp
                    327: For more information regarding the Internet
                    328: .Dq dot format ,
1.1       deraadt   329: refer to
1.12      aaron     330: .Xr inet 3 .
1.34      jmc       331: Unspecified or
1.21      aaron     332: .Dq wildcard
                    333: addresses and ports appear as a single
1.34      jmc       334: .Sq * .
1.6       deraadt   335: If a local port number is registered as being in use for RPC by
1.12      aaron     336: .Xr portmap 8 ,
1.11      aaron     337: its RPC service name or RPC service number will be printed in
1.21      aaron     338: .Dq []
                    339: immediately after the port number.
1.1       deraadt   340: .Pp
                    341: The interface display provides a table of cumulative
                    342: statistics regarding packets transferred, errors, and collisions.
                    343: The network addresses of the interface
1.21      aaron     344: and the maximum transmission unit (MTU) are also displayed.
1.1       deraadt   345: .Pp
1.21      aaron     346: The routing table display indicates the available routes and their status.
                    347: Each route consists of a destination host or network and
                    348: a gateway to use in forwarding packets.
                    349: If the destination is a
                    350: network in numeric format, the netmask (in /24 style format) is appended.
                    351: The flags field shows a collection of information about
                    352: the route stored as binary choices.
                    353: The individual flags are discussed in more detail in the
1.1       deraadt   354: .Xr route 8
                    355: and
                    356: .Xr route 4
                    357: manual pages.
1.21      aaron     358: .Pp
1.1       deraadt   359: The mapping between letters and flags is:
1.66      jmc       360: .Bl -column "1" "RTF_BLACKHOLE" "Protocol specific routing flag #1."
                    361: .It 1 Ta RTF_PROTO1 Ta "Protocol specific routing flag #1."
                    362: .It 2 Ta RTF_PROTO2 Ta "Protocol specific routing flag #2."
                    363: .It 3 Ta RTF_PROTO3 Ta "Protocol specific routing flag #3."
                    364: .It B Ta RTF_BLACKHOLE Ta "Just discard pkts (during updates)."
                    365: .It C Ta RTF_CLONING Ta "Generate new routes on use."
                    366: .It c Ta RTF_CLONED Ta "Cloned routes (generated from RTF_CLONING)."
                    367: .It D Ta RTF_DYNAMIC Ta "Created dynamically (by redirect)."
                    368: .It G Ta RTF_GATEWAY Ta "Destination requires forwarding by intermediary."
                    369: .It H Ta RTF_HOST Ta "Host entry (net otherwise)."
                    370: .It L Ta RTF_LLINFO Ta "Valid protocol to link address translation."
                    371: .It M Ta RTF_MODIFIED Ta "Modified dynamically (by redirect)."
                    372: .It P Ta RTF_MPATH Ta "Multipath route."
                    373: .It R Ta RTF_REJECT Ta "Host or net unreachable."
                    374: .It S Ta RTF_STATIC Ta "Manually added."
                    375: .It T Ta RTF_MPLS Ta "MPLS route."
                    376: .It U Ta RTF_UP Ta "Route usable."
                    377: .It X Ta RTF_XRESOLVE Ta "External daemon translates proto to link address."
1.1       deraadt   378: .El
                    379: .Pp
1.21      aaron     380: Direct routes are created for each interface attached to the local host;
1.1       deraadt   381: the gateway field for such entries shows the address of the outgoing interface.
1.21      aaron     382: The refcnt field gives the current number of active uses of the route.
                    383: Connection oriented protocols normally hold on to a single route for the
                    384: duration of a connection while connectionless protocols obtain a route while
                    385: sending to the same destination.
                    386: The use field provides a count of the number of packets sent using that route.
                    387: The MTU entry shows the MTU associated with that route.
                    388: This MTU value is used as the basis for the TCP maximum segment size (MSS).
1.34      jmc       389: The
                    390: .Sq L
                    391: flag appended to the MTU value indicates that the value is
                    392: locked, and that path MTU discovery is turned off for that route.
1.21      aaron     393: A
1.1       deraadt   394: .Sq -
1.12      aaron     395: indicates that the MTU for this route has not been set, and a default
1.21      aaron     396: TCP maximum segment size will be used.
                    397: The interface entry indicates the network interface utilized for the route.
1.1       deraadt   398: .Pp
                    399: When
1.21      aaron     400: .Nm
1.1       deraadt   401: is invoked with the
                    402: .Fl w
                    403: option and a
                    404: .Ar wait
                    405: interval argument, it displays a running count of statistics related to
                    406: network interfaces.
                    407: An obsolescent version of this option used a numeric parameter
                    408: with no option, and is currently supported for backward compatibility.
                    409: This display consists of a column for the primary interface (the first
                    410: interface found during autoconfiguration) and a column summarizing
                    411: information for all interfaces.
                    412: The primary interface may be replaced with another interface with the
                    413: .Fl I
                    414: option.
                    415: The first line of each screen of information contains a summary since the
1.21      aaron     416: system was last rebooted.
                    417: Subsequent lines of output show values accumulated over the preceding interval.
1.1       deraadt   418: .Sh SEE ALSO
1.47      jmc       419: .Xr fstat 1 ,
1.1       deraadt   420: .Xr nfsstat 1 ,
                    421: .Xr ps 1 ,
1.47      jmc       422: .Xr systat 1 ,
1.53      jmc       423: .Xr tcpbench 1 ,
1.47      jmc       424: .Xr top 1 ,
1.34      jmc       425: .Xr inet 3 ,
1.21      aaron     426: .Xr netintro 4 ,
1.34      jmc       427: .Xr route 4 ,
1.1       deraadt   428: .Xr hosts 5 ,
                    429: .Xr networks 5 ,
                    430: .Xr protocols 5 ,
                    431: .Xr services 5 ,
1.15      alex      432: .Xr iostat 8 ,
1.34      jmc       433: .Xr portmap 8 ,
1.47      jmc       434: .Xr pstat 8 ,
1.34      jmc       435: .Xr route 8 ,
1.40      jmc       436: .Xr tcpdrop 8 ,
1.1       deraadt   437: .Xr trpt 8 ,
                    438: .Xr vmstat 8
                    439: .Sh HISTORY
                    440: The
1.21      aaron     441: .Nm
1.1       deraadt   442: command appeared in
                    443: .Bx 4.2 .
1.62      schwarze  444: IPv6 support was added by the WIDE/KAME project.
1.1       deraadt   445: .Sh BUGS
                    446: The notion of errors is ill-defined.