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