1 .\" Copyright (c) 1983, 1990, 1992, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 4. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94
36 .Nd show network status and statistics
39 .Bl -tag -width "netstat"
43 .Op Fl f Ar protocol_family | Fl p Ar protocol
46 .It Nm Fl i | I Ar interface
49 .Op Fl f Ar address_family
62 .Op Fl f Ar protocol_family | Fl p Ar protocol
65 .It Nm Fl i | I Ar interface Fl s
68 .Op Fl f Ar protocol_family | Fl p Ar protocol
83 .Op Fl f Ar address_family
92 .Op Fl f Ar address_family
96 .Op Fl f Ar address_family
106 command symbolically displays the contents of various network-related
108 There are a number of output formats,
109 depending on the options for the information presented.
110 .Bl -tag -width indent
115 .Op Fl f Ar protocol_family | Fl p Ar protocol
120 Display a list of active sockets
121 (protocol control blocks)
122 for each network protocol.
124 The default display for active sockets shows the local
125 and remote addresses, send and receive queue sizes (in bytes), protocol,
126 and the internal state of the protocol.
127 Address formats are of the form
131 if a socket's address specifies a network but no specific host address.
132 When known, the host and network addresses are displayed symbolically
133 according to the databases
138 If a symbolic name for an address is unknown, or if
141 option is specified, the address is printed numerically, according
142 to the address family.
143 For more information regarding
151 addresses and ports appear as
153 .Bl -tag -width indent
157 in a selection of different human and machine readable formats.
160 for details on command line arguments.
164 .Sx GENERAL OPTIONS .
168 .Sx GENERAL OPTIONS .
170 Show the address of a protocol control block (PCB)
171 associated with a socket; used for debugging.
173 Show the state of all sockets;
174 normally sockets used by server processes are not shown.
176 Show the size of the various listen queues.
177 The first count shows the number of unaccepted connections,
178 the second count shows the amount of unaccepted incomplete connections,
179 and the third count is the maximum number of queued connections.
181 Do not resolve numeric addresses and port numbers to names.
183 .Sx GENERAL OPTIONS .
185 Display the flowid and flowtype for each socket.
186 flowid is a 32 bit hardware specific identifier for each flow.
187 flowtype defines which protocol fields are hashed to produce the id.
188 A complete listing is available in
193 Show network addresses as numbers (as with
195 but show ports symbolically.
197 Display diagnostic information from the TCP control block.
198 Fields include the number of packets requiring retransmission,
199 received out-of-order, and those advertising a zero-sized window.
201 Avoid truncating addresses even if this causes some fields to overflow.
203 Display socket buffer and TCP timer statistics for each
210 to output all the information recorded about data
211 stored in the socket buffers.
213 .Bl -column ".Li R-MBUF"
214 .It Li R-MBUF Ta Number of mbufs in the receive queue.
215 .It Li S-MBUF Ta Number of mbufs in the send queue.
216 .It Li R-CLUS Ta Number of clusters, of any type, in the receive
218 .It Li S-CLUS Ta Number of clusters, of any type, in the send queue.
219 .It Li R-HIWA Ta Receive buffer high water mark, in bytes.
220 .It Li S-HIWA Ta Send buffer high water mark, in bytes.
221 .It Li R-LOWA Ta Receive buffer low water mark, in bytes.
222 .It Li S-LOWA Ta Send buffer low water mark, in bytes.
223 .It Li R-BCNT Ta Receive buffer byte count.
224 .It Li S-BCNT Ta Send buffer byte count.
225 .It Li R-BMAX Ta Maximum bytes that can be used in the receive buffer.
226 .It Li S-BMAX Ta Maximum bytes that can be used in the send buffer.
227 .It Li rexmt Ta Time, in seconds, to fire Retransmit Timer, or 0 if not armed.
228 .It Li persist Ta Time, in seconds, to fire Retransmit Persistence, or 0 if not armed.
229 .It Li keep Ta Time, in seconds, to fire Keep Alive, or 0 if not armed.
230 .It Li 2msl Ta Time, in seconds, to fire 2*msl TIME_WAIT Timer, or 0 if not armed.
231 .It Li delack Ta Time, in seconds, to fire Delayed ACK Timer, or 0 if not armed.
232 .It Li rcvtime Ta Time, in seconds, since last packet received.
234 .It Fl f Ar protocol_family
236 .Ar protocol_family .
238 .Sx GENERAL OPTIONS .
243 .Sx GENERAL OPTIONS .
245 Use an alternative core.
247 .Sx GENERAL OPTIONS .
249 Use an alternative kernel image.
251 .Sx GENERAL OPTIONS .
256 .Fl i | I Ar interface
258 .Op Fl f Ar address_family
263 Show the state of all network interfaces or a single
265 which have been auto-configured
266 (interfaces statically configured into a system, but not
267 located at boot time are not shown).
270 after an interface name indicates that the interface is
280 it provides a table of cumulative
281 statistics regarding packets transferred, errors, and collisions.
282 The network addresses of the interface
283 and the maximum transmission unit
286 .Bl -tag -width indent
290 .Sx GENERAL OPTIONS .
294 .Sx GENERAL OPTIONS .
296 Multicast addresses currently in use are shown
297 for each Ethernet interface and for each IP interface address.
298 Multicast addresses are shown on separate lines following the interface
299 address with which they are associated.
301 Show the number of bytes in and out.
303 Show the number of dropped packets.
305 Print all counters in human readable form.
307 Do not resolve numeric addresses and port numbers to names.
309 .Sx GENERAL OPTIONS .
311 Avoid truncating interface names even if this causes some fields to overflow.
312 .Sx GENERAL OPTIONS .
313 .It Fl f Ar protocol_family
315 .Ar protocol_family .
317 .Sx GENERAL OPTIONS .
323 .Op Fl I Ar interface
332 seconds, display the information regarding packet traffic on all
333 configured network interfaces or a single
342 interval argument, it displays a running count of statistics related to
344 An obsolescent version of this option used a numeric parameter
345 with no option, and is currently supported for backward compatibility.
346 By default, this display summarizes information for all interfaces.
347 Information for a specific interface may be displayed with the
350 .Bl -tag -width indent
351 .It Fl I Ar interface
352 Only show information regarding
357 .Sx GENERAL OPTIONS .
361 .Sx GENERAL OPTIONS .
363 Show the number of dropped packets.
365 Use an alternative core.
367 .Sx GENERAL OPTIONS .
369 Use an alternative kernel image.
371 .Sx GENERAL OPTIONS .
382 .Op Fl f Ar protocol_family | Fl p Ar protocol
387 Display system-wide statistics for each network protocol.
388 .Bl -tag -width indent
392 .Sx GENERAL OPTIONS .
396 .Sx GENERAL OPTIONS .
400 is repeated, counters with a value of zero are suppressed.
402 Reset statistic counters after displaying them.
403 .It Fl f Ar protocol_family
405 .Ar protocol_family .
407 .Sx GENERAL OPTIONS .
412 .Sx GENERAL OPTIONS .
414 Use an alternative core.
416 .Sx GENERAL OPTIONS .
418 Use an alternative kernel image
420 .Sx GENERAL OPTIONS .
425 .Fl i | I Ar interface Fl s
427 .Op Fl f Ar protocol_family | Fl p Ar protocol
432 Display per-interface statistics for each network protocol.
433 .Bl -tag -width indent
437 .Sx GENERAL OPTIONS .
441 .Sx GENERAL OPTIONS .
445 is repeated, counters with a value of zero are suppressed.
446 .It Fl f Ar protocol_family
448 .Ar protocol_family .
450 .Sx GENERAL OPTIONS .
455 .Sx GENERAL OPTIONS .
457 Use an alternative core
459 .Sx GENERAL OPTIONS .
461 Use an alternative kernel image
463 .Sx GENERAL OPTIONS .
473 Show statistics recorded by the memory management routines
475 The network manages a private pool of memory buffers.
476 .Bl -tag -width indent
478 Use an alternative core
480 .Sx GENERAL OPTIONS .
482 Use an alternative kernel image
484 .Sx GENERAL OPTIONS .
491 .Op Fl I Ar interface
494 Show statistics about
497 This includes information like
498 how many packets have been matched, dropped and received by the
499 bpf device, also information about current buffer sizes and device
508 option represent the underlying parameters of the bpf peer.
510 represented as a single lower case letter.
511 The mapping between the letters and flags in order of appearance are:
513 .It Li p Ta Set if listening promiscuously
514 .It Li i Ta Dv BIOCIMMEDIATE No has been set on the device
515 .It Li f Ta Dv BIOCGHDRCMPLT No status: source link addresses are being
517 .It Li s Ta Dv BIOCGSEESENT No status: see packets originating locally and
518 remotely on the interface.
519 .It Li a Ta Packet reception generates a signal
520 .It Li l Ta Dv BIOCLOCK No status: descriptor has been locked
523 For more information about these flags, please refer to
525 .Bl -tag -width indent
527 Reset statistic counters after displaying them.
535 .Op Fl f Ar address_family
540 Display the contents of routing tables.
544 is invoked with the routing table option
546 it lists the available routes and their status.
547 Each route consists of a destination host or network, and a gateway to use
548 in forwarding packets.
549 The flags field shows a collection of information about the route stored
551 The individual flags are discussed in more detail in the
556 The mapping between letters and flags is:
557 .Bl -column ".Li W" ".Dv RTF_WASCLONED"
558 .It Li 1 Ta Dv RTF_PROTO1 Ta "Protocol specific routing flag #1"
559 .It Li 2 Ta Dv RTF_PROTO2 Ta "Protocol specific routing flag #2"
560 .It Li 3 Ta Dv RTF_PROTO3 Ta "Protocol specific routing flag #3"
561 .It Li B Ta Dv RTF_BLACKHOLE Ta "Just discard pkts (during updates)"
562 .It Li b Ta Dv RTF_BROADCAST Ta "The route represents a broadcast address"
563 .It Li D Ta Dv RTF_DYNAMIC Ta "Created dynamically (by redirect)"
564 .It Li G Ta Dv RTF_GATEWAY Ta "Destination requires forwarding by intermediary"
565 .It Li H Ta Dv RTF_HOST Ta "Host entry (net otherwise)"
566 .It Li L Ta Dv RTF_LLINFO Ta "Valid protocol to link address translation"
567 .It Li M Ta Dv RTF_MODIFIED Ta "Modified dynamically (by redirect)"
568 .It Li R Ta Dv RTF_REJECT Ta "Host or net unreachable"
569 .It Li S Ta Dv RTF_STATIC Ta "Manually added"
570 .It Li U Ta Dv RTF_UP Ta "Route usable"
571 .It Li X Ta Dv RTF_XRESOLVE Ta "External daemon translates proto to link address"
574 Direct routes are created for each
575 interface attached to the local host;
576 the gateway field for such entries shows the address of the outgoing interface.
577 The refcnt field gives the
578 current number of active uses of the route.
580 protocols normally hold on to a single route for the duration of
581 a connection while connectionless protocols obtain a route while sending
582 to the same destination.
583 The use field provides a count of the number of packets
584 sent using that route.
585 The interface entry indicates the network interface utilized for the route.
586 .Bl -tag -width indent
590 .Sx GENERAL OPTIONS .
594 .Sx GENERAL OPTIONS .
596 Do not resolve numeric addresses and port numbers to names.
598 .Sx GENERAL OPTIONS .
600 Show the path MTU for each route, and print interface names with a
603 Display the routing table with the number
610 the default routing table is displayed.
612 Display the routing table for a particular
615 Use an alternative core
617 .Sx GENERAL OPTIONS .
619 Use an alternative kernel image
621 .Sx GENERAL OPTIONS .
632 Display routing statistics.
633 .Bl -tag -width indent
637 is repeated, counters with a value of zero are suppressed.
639 Use an alternative core
641 .Sx GENERAL OPTIONS .
643 Use an alternative kernel image
645 .Sx GENERAL OPTIONS .
652 .Op Fl f Ar address_family
657 Display the contents of the multicast virtual interface tables,
658 and multicast forwarding caches.
659 Entries in these tables will appear only when the kernel is
660 actively forwarding multicast sessions.
661 This option is applicable only to the
666 .Bl -tag -width indent
670 .Sx GENERAL OPTIONS .
674 .Sx GENERAL OPTIONS .
676 Avoid truncating addresses even if this causes some fields to overflow.
677 .It Fl f Ar protocol_family
679 .Ar protocol_family .
681 .Sx GENERAL OPTIONS .
683 Use an alternative core
685 .Sx GENERAL OPTIONS .
687 Use an alternative kernel image
689 .Sx GENERAL OPTIONS .
696 .Op Fl f Ar address_family
701 Show multicast routing statistics.
702 .Bl -tag -width indent
706 .Sx GENERAL OPTIONS .
710 .Sx GENERAL OPTIONS .
714 is repeated, counters with a value of zero are suppressed.
715 .It Fl f Ar protocol_family
717 .Ar protocol_family .
719 .Sx GENERAL OPTIONS .
721 Use an alternative core
723 .Sx GENERAL OPTIONS .
725 Use an alternative kernel image
727 .Sx GENERAL OPTIONS .
738 The flags field shows available ISR handlers:
739 .Bl -column ".Li W" ".Dv NETISR_SNP_FLAGS_DRAINEDCPU"
740 .It Li C Ta Dv NETISR_SNP_FLAGS_M2CPUID Ta "Able to map mbuf to cpu id"
741 .It Li D Ta Dv NETISR_SNP_FLAGS_DRAINEDCPU Ta "Has queue drain handler"
742 .It Li F Ta Dv NETISR_SNP_FLAGS_M2FLOW Ta "Able to map mbuf to flow id"
747 Some options have the general meaning:
759 .It Fl f Ar address_family , Fl p Ar protocol
760 Limit display to those records
765 The following address families and protocols are recognized:
767 .Bl -tag -width ".Cm netgraph , ng Pq Dv AF_NETGRAPH" -compact
770 .It Cm inet Pq Dv AF_INET
771 .Cm divert , icmp , igmp , ip , ipsec , pim, sctp , tcp , udp
772 .It Cm inet6 Pq Dv AF_INET6
773 .Cm icmp6 , ip6 , ipsec6 , rip6 , tcp , udp
774 .It Cm pfkey Pq Dv PF_KEY
776 .It Cm netgraph , ng Pq Dv AF_NETGRAPH
778 .It Cm unix Pq Dv AF_UNIX
779 .It Cm link Pq Dv AF_LINK
782 The program will complain if
784 is unknown or if there is no statistics routine for it.
786 Extract values associated with the name list from the specified core
787 instead of the default
790 Extract the name list from the specified system instead of the default,
791 which is the kernel image the system has booted from.
793 Show network addresses and ports as numbers.
796 attempts to resolve addresses and ports,
797 and display them symbolically.
806 .Xr xo_parse_args 3 ,
826 IPv6 support was added by WIDE/KAME project.
828 The notion of errors is ill-defined.