]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/netstat/netstat.1
zfs: merge openzfs/zfs@887a3c533
[FreeBSD/FreeBSD.git] / usr.bin / netstat / netstat.1
1 .\" Copyright (c) 1983, 1990, 1992, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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 .\" 3. 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.
15 .\"
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
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)netstat.1   8.8 (Berkeley) 4/18/94
29 .\"
30 .Dd August 14, 2023
31 .Dt NETSTAT 1
32 .Os
33 .Sh NAME
34 .Nm netstat
35 .Nd show network status and statistics
36 .Sh SYNOPSIS
37 .Bk -words
38 .Bl -tag -width "netstat"
39 .It Nm
40 .Op Fl j Ar jail
41 .Op Fl -libxo
42 .Op Fl 46AaCLnPRSTWx
43 .Op Fl f Ar protocol_family | Fl p Ar protocol
44 .It Nm Fl i | I Ar interface
45 .Op Fl j Ar jail
46 .Op Fl -libxo
47 .Op Fl 46abdhnW
48 .Op Fl f Ar address_family
49 .Op Fl M Ar core
50 .Op Fl N Ar system
51 .It Nm Fl w Ar wait
52 .Op Fl j Ar jail
53 .Op Fl -libxo
54 .Op Fl I Ar interface
55 .Op Fl 46d
56 .Op Fl M Ar core
57 .Op Fl N Ar system
58 .Op Fl q Ar howmany
59 .It Nm Fl s
60 .Op Fl j Ar jail
61 .Op Fl -libxo
62 .Op Fl 46sz
63 .Op Fl f Ar protocol_family | Fl p Ar protocol
64 .Op Fl M Ar core
65 .Op Fl N Ar system
66 .It Nm Fl i | I Ar interface Fl s
67 .Op Fl j Ar jail
68 .Op Fl -libxo
69 .Op Fl 46s
70 .Op Fl f Ar protocol_family | Fl p Ar protocol
71 .Op Fl M Ar core
72 .Op Fl N Ar system
73 .It Nm Fl m
74 .Op Fl j Ar jail
75 .Op Fl -libxo
76 .Op Fl M Ar core
77 .Op Fl N Ar system
78 .It Nm Fl B
79 .Op Fl j Ar jail
80 .Op Fl -libxo
81 .Op Fl z
82 .Op Fl I Ar interface
83 .It Nm Fl r
84 .Op Fl j Ar jail
85 .Op Fl -libxo
86 .Op Fl 46nW
87 .Op Fl F Ar fibnum
88 .Op Fl f Ar address_family
89 .It Nm Fl rs
90 .Op Fl j Ar jail
91 .Op Fl -libxo
92 .Op Fl s
93 .Op Fl M Ar core
94 .Op Fl N Ar system
95 .It Nm Fl g
96 .Op Fl j Ar jail
97 .Op Fl -libxo
98 .Op Fl 46W
99 .Op Fl f Ar address_family
100 .It Nm Fl gs
101 .Op Fl j Ar jail
102 .Op Fl -libxo
103 .Op Fl 46s
104 .Op Fl f Ar address_family
105 .Op Fl M Ar core
106 .Op Fl N Ar system
107 .It Nm Fl Q
108 .Op Fl j Ar jail
109 .Op Fl -libxo
110 .El
111 .Ek
112 .Sh DESCRIPTION
113 The
114 .Nm
115 command shows the contents of various network-related
116 data structures.
117 The arguments passed determine which of the below output formats the
118 command uses.
119 .Bl -tag -width indent
120 .It Xo
121 .Bk -words
122 .Nm
123 .Op Fl 46AaCLnRSTWx
124 .Op Fl f Ar protocol_family | Fl p Ar protocol
125 .Op Fl j Ar jail
126 .Ek
127 .Xc
128 Display a list of active sockets
129 (protocol control blocks)
130 for each network protocol.
131 .Pp
132 The default display for active sockets shows the local
133 and remote addresses, send and receive queue sizes (in bytes), protocol,
134 and the internal state of the protocol.
135 Address formats are of the form
136 .Dq host.port
137 or
138 .Dq network.port
139 if a socket's address specifies a network but no specific host address.
140 When known, the host and network addresses are displayed symbolically
141 according to the databases
142 .Xr hosts 5
143 and
144 .Xr networks 5 ,
145 respectively.
146 If a symbolic name for an address is unknown, or if
147 the
148 .Fl n
149 option is specified, the address is printed numerically, according
150 to the address family.
151 For more information regarding
152 the Internet IPv4
153 .Dq dot format ,
154 refer to
155 .Xr inet 3 .
156 Unspecified,
157 or
158 .Dq wildcard ,
159 addresses and ports appear as
160 .Dq Li * .
161 .Bl -tag -width indent
162 .It Fl -libxo
163 Generate output via
164 .Xr libxo 3
165 in a selection of different human and machine readable formats.
166 See
167 .Xr xo_parse_args 3
168 for details on command line arguments.
169 .It Fl 4
170 Show IPv4 only.
171 See
172 .Sx GENERAL OPTIONS .
173 .It Fl 6
174 Show IPv6 only.
175 See
176 .Sx GENERAL OPTIONS .
177 .It Fl A
178 Show the address of a protocol control block (PCB)
179 associated with a socket; used for debugging.
180 .It Fl a
181 Show the state of all sockets;
182 normally sockets used by server processes are not shown.
183 .It Fl c
184 Show the used TCP stack for each session.
185 .It Fl C
186 Show the congestion control algorithm and diagnostic information of TCP sockets.
187 .It Fl L
188 Show the size of the various listen queues.
189 The first count shows the number of unaccepted connections,
190 the second count shows the amount of unaccepted incomplete connections,
191 and the third count is the maximum number of queued connections.
192 .It Fl n
193 Do not resolve numeric addresses and port numbers to names.
194 See
195 .Sx GENERAL OPTIONS .
196 .It Fl P
197 Display the log ID for each socket.
198 .It Fl R
199 Display the flowid and flowtype for each socket.
200 flowid is a 32 bit hardware specific identifier for each flow.
201 flowtype defines which protocol fields are hashed to produce the id.
202 A complete listing is available in
203 .Pa sys/mbuf.h
204 under
205 .Dv M_HASHTYPE_* .
206 .It Fl S
207 Show network addresses as numbers (as with
208 .Fl n )
209 but show ports symbolically.
210 .It Fl T
211 Display diagnostic information from the TCP control block.
212 Fields include the number of packets requiring retransmission,
213 received out-of-order, and those advertising a zero-sized window.
214 .It Fl W
215 Avoid truncating addresses even if this causes some fields to overflow.
216 .It Fl x
217 Display socket buffer and TCP timer statistics for each
218 internet socket.
219 .Pp
220 The
221 .Fl x
222 flag causes
223 .Nm
224 to output all the information recorded about data
225 stored in the socket buffers.
226 The fields are:
227 .Bl -column ".Li R-HIWA"
228 .It Li R-HIWA Ta Receive buffer high water mark, in bytes.
229 .It Li S-HIWA Ta Send buffer high water mark, in bytes.
230 .It Li R-LOWA Ta Receive buffer low water mark, in bytes.
231 .It Li S-LOWA Ta Send buffer low water mark, in bytes.
232 .It Li R-BCNT Ta Receive buffer byte count.
233 .It Li S-BCNT Ta Send buffer byte count.
234 .It Li R-BMAX Ta Maximum bytes that can be used in the receive buffer.
235 .It Li S-BMAX Ta Maximum bytes that can be used in the send buffer.
236 .It Li rexmt Ta Time, in seconds, to fire Retransmit Timer, or 0 if not armed.
237 .It Li persist Ta Time, in seconds, to fire Retransmit Persistence, or 0 if not armed.
238 .It Li keep Ta Time, in seconds, to fire Keep Alive, or 0 if not armed.
239 .It Li 2msl Ta Time, in seconds, to fire 2*msl TIME_WAIT Timer, or 0 if not armed.
240 .It Li delack Ta Time, in seconds, to fire Delayed ACK Timer, or 0 if not armed.
241 .It Li rcvtime Ta Time, in seconds, since last packet received.
242 .El
243 .It Fl f Ar protocol_family
244 Filter by
245 .Ar protocol_family .
246 See
247 .Sx GENERAL OPTIONS .
248 .It Fl p Ar protocol
249 Filter by
250 .Ar protocol .
251 See
252 .Sx GENERAL OPTIONS .
253 .It Fl j Ar jail
254 Run inside a jail.
255 See
256 .Sx GENERAL OPTIONS .
257 .El
258 .It Xo
259 .Bk -words
260 .Nm
261 .Fl i | I Ar interface
262 .Op Fl 46abdhnW
263 .Op Fl f Ar address_family
264 .Op Fl M Ar core
265 .Op Fl N Ar system
266 .Op Fl j Ar jail
267 .Ek
268 .Xc
269 Show the state of all network interfaces or a single
270 .Ar interface
271 which have been auto-configured
272 (interfaces statically configured into a system, but not
273 located at boot time are not shown).
274 An asterisk
275 .Pq Dq Li *
276 after an interface name indicates that the interface is
277 .Dq down .
278 .Pp
279 When
280 .Nm
281 is invoked with
282 .Fl i
283 .Pq all interfaces
284 or
285 .Fl I Ar interface ,
286 it provides a table of cumulative
287 statistics regarding packets transferred, errors, and collisions.
288 The network addresses of the interface
289 and the maximum transmission unit
290 .Pq Dq mtu
291 are also displayed.
292 If both
293 .Fl i
294 and
295 .Fl I
296 are specified,
297 .Fl I
298 overrides any instances of
299 .Fl i .
300 .Bl -tag -width indent
301 .It Fl 4
302 Show IPv4 only.
303 See
304 .Sx GENERAL OPTIONS .
305 .It Fl 6
306 Show IPv6 only.
307 See
308 .Sx GENERAL OPTIONS .
309 .It Fl a
310 Multicast addresses currently in use are shown
311 for each Ethernet interface and for each IP interface address.
312 Multicast addresses are shown on separate lines following the interface
313 address with which they are associated.
314 .It Fl b
315 Show the number of bytes in and out.
316 .It Fl d
317 Show the number of dropped packets.
318 .It Fl h
319 Print all counters in human readable form.
320 .It Fl n
321 Do not resolve numeric addresses and port numbers to names.
322 See
323 .Sx GENERAL OPTIONS .
324 .It Fl W
325 Avoid truncating addresses even if this causes some fields to overflow.
326 See
327 .Sx GENERAL OPTIONS .
328 However, in most cases field widths are determined automatically with the
329 .Fl i
330 option, and this option has little effect.
331 .It Fl f Ar protocol_family
332 Filter by
333 .Ar protocol_family .
334 See
335 .Sx GENERAL OPTIONS .
336 .It Fl j Ar jail
337 Run inside a jail.
338 See
339 .Sx GENERAL OPTIONS .
340 .El
341 .It Xo
342 .Bk -words
343 .Nm
344 .Fl w Ar wait
345 .Op Fl I Ar interface
346 .Op Fl 46d
347 .Op Fl M Ar core
348 .Op Fl N Ar system
349 .Op Fl q Ar howmany
350 .Op Fl j Ar jail
351 .Ek
352 .Xc
353 At intervals of
354 .Ar wait
355 seconds, display the information regarding packet traffic on all
356 configured network interfaces or a single
357 .Ar interface .
358 .Pp
359 When
360 .Nm
361 is invoked with the
362 .Fl w
363 option and a
364 .Ar wait
365 interval argument, it displays a running count of statistics related to
366 network interfaces.
367 An obsolescent version of this option used a numeric parameter
368 with no option, and is currently supported for backward compatibility.
369 By default, this display summarizes information for all interfaces.
370 Information for a specific interface may be displayed with the
371 .Fl I Ar interface
372 option.
373 .Bl -tag -width indent
374 .It Fl I Ar interface
375 Only show information regarding
376 .Ar interface
377 .It Fl 4
378 Show IPv4 only.
379 See
380 .Sx GENERAL OPTIONS .
381 .It Fl 6
382 Show IPv6 only.
383 See
384 .Sx GENERAL OPTIONS .
385 .It Fl d
386 Show the number of dropped packets.
387 .It Fl M
388 Use an alternative core.
389 See
390 .Sx GENERAL OPTIONS .
391 .It Fl N
392 Use an alternative kernel image.
393 See
394 .Sx GENERAL OPTIONS .
395 .It Fl q
396 Exit after
397 .Ar howmany
398 outputs.
399 .It Fl j Ar jail
400 Run inside a jail.
401 See
402 .Sx GENERAL OPTIONS .
403 .El
404 .It Xo
405 .Bk -words
406 .Nm
407 .Fl s
408 .Op Fl 46sz
409 .Op Fl f Ar protocol_family | Fl p Ar protocol
410 .Op Fl M Ar core
411 .Op Fl N Ar system
412 .Op Fl j Ar jail
413 .Ek
414 .Xc
415 Display system-wide statistics for each network protocol.
416 .Bl -tag -width indent
417 .It Fl 4
418 Show IPv4 only.
419 See
420 .Sx GENERAL OPTIONS .
421 .It Fl 6
422 Show IPv6 only.
423 See
424 .Sx GENERAL OPTIONS .
425 .It Fl s
426 If
427 .Fl s
428 is repeated, counters with a value of zero are suppressed.
429 .It Fl z
430 Reset statistic counters after displaying them.
431 .It Fl f Ar protocol_family
432 Filter by
433 .Ar protocol_family .
434 See
435 .Sx GENERAL OPTIONS .
436 .It Fl p Ar protocol
437 Filter by
438 .Ar protocol .
439 See
440 .Sx GENERAL OPTIONS .
441 .It Fl M
442 Use an alternative core.
443 See
444 .Sx GENERAL OPTIONS .
445 .It Fl N
446 Use an alternative kernel image
447 See
448 .Sx GENERAL OPTIONS .
449 .It Fl j Ar jail
450 Run inside a jail.
451 See
452 .Sx GENERAL OPTIONS .
453 .El
454 .It Xo
455 .Bk -words
456 .Nm
457 .Fl i | I Ar interface Fl s
458 .Op Fl 46s
459 .Op Fl f Ar protocol_family | Fl p Ar protocol
460 .Op Fl M Ar core
461 .Op Fl N Ar system
462 .Op Fl j Ar jail
463 .Ek
464 .Xc
465 Display per-interface statistics for each network protocol.
466 If both
467 .Fl i
468 and
469 .Fl I
470 are specified,
471 .Fl I
472 overrides any instances of
473 .Fl i .
474 .Bl -tag -width indent
475 .It Fl 4
476 Show IPv4 only
477 See
478 .Sx GENERAL OPTIONS .
479 .It Fl 6
480 Show IPv6 only
481 See
482 .Sx GENERAL OPTIONS .
483 .It Fl s
484 If
485 .Fl s
486 is repeated, counters with a value of zero are suppressed.
487 .It Fl f Ar protocol_family
488 Filter by
489 .Ar protocol_family .
490 See
491 .Sx GENERAL OPTIONS .
492 .It Fl p Ar protocol
493 Filter by
494 .Ar protocol .
495 See
496 .Sx GENERAL OPTIONS .
497 .It Fl M
498 Use an alternative core
499 See
500 .Sx GENERAL OPTIONS .
501 .It Fl N
502 Use an alternative kernel image
503 See
504 .Sx GENERAL OPTIONS .
505 .It Fl j Ar jail
506 Run inside a jail.
507 See
508 .Sx GENERAL OPTIONS .
509 .El
510 .It Xo
511 .Bk -words
512 .Nm
513 .Fl m
514 .Op Fl M Ar core
515 .Op Fl N Ar system
516 .Op Fl j Ar jail
517 .Ek
518 .Xc
519 Show statistics recorded by the memory management routines
520 .Pq Xr mbuf 9 .
521 The network manages a private pool of memory buffers.
522 .Bl -tag -width indent
523 .It Fl M
524 Use an alternative core
525 See
526 .Sx GENERAL OPTIONS .
527 .It Fl N
528 Use an alternative kernel image
529 See
530 .Sx GENERAL OPTIONS .
531 .It Fl j Ar jail
532 Run inside a jail.
533 See
534 .Sx GENERAL OPTIONS .
535 .El
536 .It Xo
537 .Bk -words
538 .Nm
539 .Fl B
540 .Op Fl z
541 .Op Fl I Ar interface
542 .Op Fl j Ar jail
543 .Ek
544 .Xc
545 Show statistics about
546 .Xr bpf 4
547 peers.
548 This includes information like
549 how many packets have been matched, dropped and received by the
550 bpf device, also information about current buffer sizes and device
551 states.
552 .Pp
553 The
554 .Xr bpf 4
555 flags displayed when
556 .Nm
557 is invoked with the
558 .Fl B
559 option represent the underlying parameters of the bpf peer.
560 Each flag is
561 represented as a single lower case letter.
562 The mapping between the letters and flags in order of appearance are:
563 .Bl -column ".Li i"
564 .It Li p Ta Set if listening promiscuously
565 .It Li i Ta Dv BIOCIMMEDIATE No has been set on the device
566 .It Li f Ta Dv BIOCGHDRCMPLT No status: source link addresses are being
567 filled automatically
568 .It Li s Ta Dv BIOCGSEESENT No status: see packets originating locally and
569 remotely on the interface.
570 .It Li a Ta Packet reception generates a signal
571 .It Li l Ta Dv BIOCLOCK No status: descriptor has been locked
572 .El
573 .Pp
574 For more information about these flags, please refer to
575 .Xr bpf 4 .
576 .Bl -tag -width indent
577 .It Fl z
578 Reset statistic counters after displaying them.
579 .It Fl j Ar jail
580 Run inside a jail.
581 See
582 .Sx GENERAL OPTIONS .
583 .El
584 .It Xo
585 .Bk -words
586 .Nm
587 .Fl r
588 .Op Fl 46AnW
589 .Op Fl F Ar fibnum
590 .Op Fl f Ar address_family
591 .Op Fl M Ar core
592 .Op Fl N Ar system
593 .Op Fl j Ar jail
594 .Ek
595 .Xc
596 Display the contents of routing tables.
597 .Pp
598 When
599 .Nm
600 is invoked with the routing table option
601 .Fl r ,
602 it lists the available routes and their status.
603 Each route consists of a destination host or network, and a gateway to use
604 in forwarding packets.
605 The flags field shows a collection of information about the route stored
606 as binary choices.
607 The individual flags are discussed in more detail in the
608 .Xr route 8
609 and
610 .Xr route 4
611 manual pages.
612 The mapping between letters and flags is:
613 .Bl -column ".Li W" ".Dv RTF_WASCLONED"
614 .It Li 1 Ta Dv RTF_PROTO1 Ta "Protocol specific routing flag #1"
615 .It Li 2 Ta Dv RTF_PROTO2 Ta "Protocol specific routing flag #2"
616 .It Li 3 Ta Dv RTF_PROTO3 Ta "Protocol specific routing flag #3"
617 .It Li B Ta Dv RTF_BLACKHOLE Ta "Just discard pkts (during updates)"
618 .It Li b Ta Dv RTF_BROADCAST Ta "The route represents a broadcast address"
619 .It Li D Ta Dv RTF_DYNAMIC Ta "Created dynamically (by redirect)"
620 .It Li G Ta Dv RTF_GATEWAY Ta "Destination requires forwarding by intermediary"
621 .It Li H Ta Dv RTF_HOST Ta "Host entry (net otherwise)"
622 .It Li L Ta Dv RTF_LLINFO Ta "Valid protocol to link address translation"
623 .It Li M Ta Dv RTF_MODIFIED Ta "Modified dynamically (by redirect)"
624 .It Li R Ta Dv RTF_REJECT Ta "Host or net unreachable"
625 .It Li S Ta Dv RTF_STATIC Ta "Manually added"
626 .It Li U Ta Dv RTF_UP Ta "Route usable"
627 .It Li X Ta Dv RTF_XRESOLVE Ta "External daemon translates proto to link address"
628 .El
629 .Pp
630 Direct routes are created for each
631 interface attached to the local host;
632 the gateway field for such entries shows the address of the outgoing interface.
633 The refcnt field gives the
634 current number of active uses of the route.
635 Connection oriented
636 protocols normally hold on to a single route for the duration of
637 a connection while connectionless protocols obtain a route while sending
638 to the same destination.
639 The use field provides a count of the number of packets
640 sent using that route.
641 The interface entry indicates the network interface utilized for the route.
642 .Bl -tag -width indent
643 .It Fl 4
644 Show IPv4 only.
645 See
646 .Sx GENERAL OPTIONS .
647 .It Fl 6
648 Show IPv6 only.
649 See
650 .Sx GENERAL OPTIONS .
651 .It Fl n
652 Do not resolve numeric addresses and port numbers to names.
653 See
654 .Sx GENERAL OPTIONS .
655 .It Fl W
656 Show the path MTU for each route, and print interface names with a
657 wider field size.
658 .It Fl F
659 Display the routing table with the number
660 .Ar fibnum .
661 If the specified
662 .Ar fibnum
663 is -1 or
664 .Fl F
665 is not specified,
666 the default routing table is displayed.
667 .It Fl f
668 Display the routing table for a particular
669 .Ar address_family .
670 .It Fl M
671 Use an alternative core
672 See
673 .Sx GENERAL OPTIONS .
674 .It Fl N
675 Use an alternative kernel image
676 See
677 .Sx GENERAL OPTIONS .
678 .It Fl j Ar jail
679 Run inside a jail.
680 See
681 .Sx GENERAL OPTIONS .
682 .El
683 .It Xo
684 .Bk -words
685 .Nm
686 .Fl rs
687 .Op Fl s
688 .Op Fl M Ar core
689 .Op Fl N Ar system
690 .Op Fl j Ar jail
691 .Ek
692 .Xc
693 Display routing statistics.
694 .Bl -tag -width indent
695 .It Fl s
696 If
697 .Fl s
698 is repeated, counters with a value of zero are suppressed.
699 .It Fl M
700 Use an alternative core
701 See
702 .Sx GENERAL OPTIONS .
703 .It Fl N
704 Use an alternative kernel image
705 See
706 .Sx GENERAL OPTIONS .
707 .It Fl j Ar jail
708 Run inside a jail.
709 See
710 .Sx GENERAL OPTIONS .
711 .El
712 .It Xo
713 .Bk -words
714 .Nm
715 .Fl g
716 .Op Fl 46W
717 .Op Fl f Ar address_family
718 .Op Fl M Ar core
719 .Op Fl N Ar system
720 .Op Fl j Ar jail
721 .Ek
722 .Xc
723 Display the contents of the multicast virtual interface tables,
724 and multicast forwarding caches.
725 Entries in these tables will appear only when the kernel is
726 actively forwarding multicast sessions.
727 This option is applicable only to the
728 .Cm inet
729 and
730 .Cm inet6
731 address families.
732 .Bl -tag -width indent
733 .It Fl 4
734 Show IPv4 only
735 See
736 .Sx GENERAL OPTIONS .
737 .It Fl 6
738 Show IPv6 only
739 See
740 .Sx GENERAL OPTIONS .
741 .It Fl W
742 Avoid truncating addresses even if this causes some fields to overflow.
743 .It Fl f Ar protocol_family
744 Filter by
745 .Ar protocol_family .
746 See
747 .Sx GENERAL OPTIONS .
748 .It Fl M
749 Use an alternative core
750 See
751 .Sx GENERAL OPTIONS .
752 .It Fl N
753 Use an alternative kernel image
754 See
755 .Sx GENERAL OPTIONS .
756 .It Fl j Ar jail
757 Run inside a jail.
758 See
759 .Sx GENERAL OPTIONS .
760 .El
761 .It Xo
762 .Bk -words
763 .Nm
764 .Fl gs
765 .Op Fl 46s
766 .Op Fl f Ar address_family
767 .Op Fl M Ar core
768 .Op Fl N Ar system
769 .Op Fl j Ar jail
770 .Ek
771 .Xc
772 Show multicast routing statistics.
773 .Bl -tag -width indent
774 .It Fl 4
775 Show IPv4 only
776 See
777 .Sx GENERAL OPTIONS .
778 .It Fl 6
779 Show IPv6 only
780 See
781 .Sx GENERAL OPTIONS .
782 .It Fl s
783 If
784 .Fl s
785 is repeated, counters with a value of zero are suppressed.
786 .It Fl f Ar protocol_family
787 Filter by
788 .Ar protocol_family .
789 See
790 .Sx GENERAL OPTIONS .
791 .It Fl M
792 Use an alternative core
793 See
794 .Sx GENERAL OPTIONS .
795 .It Fl N
796 Use an alternative kernel image
797 See
798 .Sx GENERAL OPTIONS .
799 .It Fl j Ar jail
800 Run inside a jail.
801 See
802 .Sx GENERAL OPTIONS .
803 .El
804 .It Xo
805 .Bk -words
806 .Nm
807 .Fl Q
808 .Op Fl j Ar jail
809 .Ek
810 .Xc
811 Show
812 .Xr netisr 9
813 statistics.
814 The flags field shows available ISR handlers:
815 .Bl -column ".Li W" ".Dv NETISR_SNP_FLAGS_DRAINEDCPU"
816 .It Li C Ta Dv NETISR_SNP_FLAGS_M2CPUID Ta "Able to map mbuf to cpu id"
817 .It Li D Ta Dv NETISR_SNP_FLAGS_DRAINEDCPU  Ta "Has queue drain handler"
818 .It Li F Ta Dv NETISR_SNP_FLAGS_M2FLOW Ta "Able to map mbuf to flow id"
819 .It Fl j Ar jail
820 Run inside a jail.
821 See
822 .Sx GENERAL OPTIONS .
823 .El
824 .El
825 .Ss GENERAL OPTIONS
826 Some options have the general meaning:
827 .Bl -tag -width flag
828 .It Fl 4
829 Is shorthand for
830 .Fl f
831 .Ar inet
832 .Pq Show only IPv4
833 .It Fl 6
834 Is shorthand for
835 .Fl f
836 .Ar inet6
837 .Pq Show only IPv6
838 .It Fl f Ar address_family , Fl p Ar protocol
839 Limit display to those records
840 of the specified
841 .Ar address_family
842 or a single
843 .Ar protocol .
844 The following address families and protocols are recognized:
845 .Pp
846 .Bl -tag -width ".Cm netgraph , ng Pq Dv AF_NETGRAPH" -compact
847 .It Em Family
848 .Em Protocols
849 .It Cm inet Pq Dv AF_INET
850 .Cm divert , icmp , igmp , ip , ipsec , pim, sctp , tcp , udp
851 .It Cm inet6 Pq Dv AF_INET6
852 .Cm icmp6 , ip6 , ipsec6 , rip6 , sctp , tcp , udp
853 .It Cm pfkey Pq Dv PF_KEY
854 .Cm pfkey
855 .It Cm netgraph , ng Pq Dv AF_NETGRAPH
856 .Cm ctrl , data
857 .It Cm unix Pq Dv AF_UNIX
858 .It Cm link Pq Dv AF_LINK
859 .El
860 .Pp
861 The program will complain if
862 .Ar protocol
863 is unknown or if there is no statistics routine for it.
864 .It Fl M
865 Extract values associated with the name list from the specified core
866 instead of the default
867 .Pa /dev/kmem .
868 .It Fl N
869 Extract the name list from the specified system instead of the default,
870 which is the kernel image the system has booted from.
871 .It Fl n
872 Show network addresses and ports as numbers.
873 Normally
874 .Nm
875 attempts to resolve addresses and ports,
876 and display them symbolically.
877 .It Fl W
878 Wider output; expand address fields, etc, to avoid truncation.
879 Non-numeric values such as domain names may still be truncated; use the
880 .Fl n
881 option if necessary to avoid ambiguity.
882 .It Fl j Ar jail
883 Perform the actions inside the
884 .Ar jail .
885 This allows network state to be accessed even if the
886 .Cm netstat
887 binary is not available in the
888 .Ar jail .
889 .El
890 .Sh EXAMPLES
891 Show packet traffic information (packets, bytes, errors, packet drops, etc) for
892 interface re0 updated every 2 seconds and exit after 5 outputs:
893 .Bd -literal -offset indent
894 $ netstat -w 2 -q 5 -I re0
895 .Ed
896 .Pp
897 Show statistics for ICMP on any interface:
898 .Bd -literal -offset indent
899 $ netstat -s -p icmp
900 .Ed
901 .Pp
902 Show routing tables:
903 .Bd -literal -offset indent
904 $ netstat -r
905 .Ed
906 .Pp
907 Same as above, but without resolving numeric addresses and port numbers to
908 names:
909 .Bd -literal -offset indent
910 $ netstat -rn
911 .Ed
912 .Sh SEE ALSO
913 .Xr fstat 1 ,
914 .Xr nfsstat 1 ,
915 .Xr procstat 1 ,
916 .Xr ps 1 ,
917 .Xr sockstat 1 ,
918 .Xr libxo 3 ,
919 .Xr xo_parse_args 3 ,
920 .Xr bpf 4 ,
921 .Xr inet 4 ,
922 .Xr route 4 ,
923 .Xr unix 4 ,
924 .Xr hosts 5 ,
925 .Xr networks 5 ,
926 .Xr protocols 5 ,
927 .Xr services 5 ,
928 .Xr iostat 8 ,
929 .Xr route 8 ,
930 .Xr vmstat 8 ,
931 .Xr mbuf 9
932 .Sh HISTORY
933 The
934 .Nm
935 command appeared in
936 .Bx 4.2 .
937 .Pp
938 IPv6 support was added by WIDE/KAME project.
939 .Sh BUGS
940 The notion of errors is ill-defined.