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

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