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