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