xref: /freebsd/usr.bin/netstat/netstat.1 (revision 734e82fe33aa764367791a7d603b383996c6b40b)
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
113The
114.Nm
115command shows the contents of various network-related
116data structures.
117The arguments passed determine which of the below output formats the
118command 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
128Display a list of active sockets
129(protocol control blocks)
130for each network protocol.
131.Pp
132The default display for active sockets shows the local
133and remote addresses, send and receive queue sizes (in bytes), protocol,
134and the internal state of the protocol.
135Address formats are of the form
136.Dq host.port
137or
138.Dq network.port
139if a socket's address specifies a network but no specific host address.
140When known, the host and network addresses are displayed symbolically
141according to the databases
142.Xr hosts 5
143and
144.Xr networks 5 ,
145respectively.
146If a symbolic name for an address is unknown, or if
147the
148.Fl n
149option is specified, the address is printed numerically, according
150to the address family.
151For more information regarding
152the Internet IPv4
153.Dq dot format ,
154refer to
155.Xr inet 3 .
156Unspecified,
157or
158.Dq wildcard ,
159addresses and ports appear as
160.Dq Li * .
161.Bl -tag -width indent
162.It Fl -libxo
163Generate output via
164.Xr libxo 3
165in a selection of different human and machine readable formats.
166See
167.Xr xo_parse_args 3
168for details on command line arguments.
169.It Fl 4
170Show IPv4 only.
171See
172.Sx GENERAL OPTIONS .
173.It Fl 6
174Show IPv6 only.
175See
176.Sx GENERAL OPTIONS .
177.It Fl A
178Show the address of a protocol control block (PCB)
179associated with a socket; used for debugging.
180.It Fl a
181Show the state of all sockets;
182normally sockets used by server processes are not shown.
183.It Fl c
184Show the used TCP stack for each session.
185.It Fl C
186Show the congestion control algorithm and diagnostic information of TCP sockets.
187.It Fl L
188Show the size of the various listen queues.
189The first count shows the number of unaccepted connections,
190the second count shows the amount of unaccepted incomplete connections,
191and the third count is the maximum number of queued connections.
192.It Fl n
193Do not resolve numeric addresses and port numbers to names.
194See
195.Sx GENERAL OPTIONS .
196.It Fl P
197Display the log ID for each socket.
198.It Fl R
199Display the flowid and flowtype for each socket.
200flowid is a 32 bit hardware specific identifier for each flow.
201flowtype defines which protocol fields are hashed to produce the id.
202A complete listing is available in
203.Pa sys/mbuf.h
204under
205.Dv M_HASHTYPE_* .
206.It Fl S
207Show network addresses as numbers (as with
208.Fl n )
209but show ports symbolically.
210.It Fl T
211Display diagnostic information from the TCP control block.
212Fields include the number of packets requiring retransmission,
213received out-of-order, and those advertising a zero-sized window.
214.It Fl W
215Avoid truncating addresses even if this causes some fields to overflow.
216.It Fl x
217Display socket buffer and TCP timer statistics for each
218internet socket.
219.Pp
220The
221.Fl x
222flag causes
223.Nm
224to output all the information recorded about data
225stored in the socket buffers.
226The 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
244Filter by
245.Ar protocol_family .
246See
247.Sx GENERAL OPTIONS .
248.It Fl p Ar protocol
249Filter by
250.Ar protocol .
251See
252.Sx GENERAL OPTIONS .
253.It Fl j Ar jail
254Run inside a jail.
255See
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
269Show the state of all network interfaces or a single
270.Ar interface
271which have been auto-configured
272(interfaces statically configured into a system, but not
273located at boot time are not shown).
274An asterisk
275.Pq Dq Li *
276after an interface name indicates that the interface is
277.Dq down .
278.Pp
279When
280.Nm
281is invoked with
282.Fl i
283.Pq all interfaces
284or
285.Fl I Ar interface ,
286it provides a table of cumulative
287statistics regarding packets transferred, errors, and collisions.
288The network addresses of the interface
289and the maximum transmission unit
290.Pq Dq mtu
291are also displayed.
292If both
293.Fl i
294and
295.Fl I
296are specified,
297.Fl I
298overrides any instances of
299.Fl i .
300.Bl -tag -width indent
301.It Fl 4
302Show IPv4 only.
303See
304.Sx GENERAL OPTIONS .
305.It Fl 6
306Show IPv6 only.
307See
308.Sx GENERAL OPTIONS .
309.It Fl a
310Multicast addresses currently in use are shown
311for each Ethernet interface and for each IP interface address.
312Multicast addresses are shown on separate lines following the interface
313address with which they are associated.
314.It Fl b
315Show the number of bytes in and out.
316.It Fl d
317Show the number of dropped packets.
318.It Fl h
319Print all counters in human readable form.
320.It Fl n
321Do not resolve numeric addresses and port numbers to names.
322See
323.Sx GENERAL OPTIONS .
324.It Fl W
325Avoid truncating addresses even if this causes some fields to overflow.
326See
327.Sx GENERAL OPTIONS .
328However, in most cases field widths are determined automatically with the
329.Fl i
330option, and this option has little effect.
331.It Fl f Ar protocol_family
332Filter by
333.Ar protocol_family .
334See
335.Sx GENERAL OPTIONS .
336.It Fl j Ar jail
337Run inside a jail.
338See
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
353At intervals of
354.Ar wait
355seconds, display the information regarding packet traffic on all
356configured network interfaces or a single
357.Ar interface .
358.Pp
359When
360.Nm
361is invoked with the
362.Fl w
363option and a
364.Ar wait
365interval argument, it displays a running count of statistics related to
366network interfaces.
367An obsolescent version of this option used a numeric parameter
368with no option, and is currently supported for backward compatibility.
369By default, this display summarizes information for all interfaces.
370Information for a specific interface may be displayed with the
371.Fl I Ar interface
372option.
373.Bl -tag -width indent
374.It Fl I Ar interface
375Only show information regarding
376.Ar interface
377.It Fl 4
378Show IPv4 only.
379See
380.Sx GENERAL OPTIONS .
381.It Fl 6
382Show IPv6 only.
383See
384.Sx GENERAL OPTIONS .
385.It Fl d
386Show the number of dropped packets.
387.It Fl M
388Use an alternative core.
389See
390.Sx GENERAL OPTIONS .
391.It Fl N
392Use an alternative kernel image.
393See
394.Sx GENERAL OPTIONS .
395.It Fl q
396Exit after
397.Ar howmany
398outputs.
399.It Fl j Ar jail
400Run inside a jail.
401See
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
415Display system-wide statistics for each network protocol.
416.Bl -tag -width indent
417.It Fl 4
418Show IPv4 only.
419See
420.Sx GENERAL OPTIONS .
421.It Fl 6
422Show IPv6 only.
423See
424.Sx GENERAL OPTIONS .
425.It Fl s
426If
427.Fl s
428is repeated, counters with a value of zero are suppressed.
429.It Fl z
430Reset statistic counters after displaying them.
431.It Fl f Ar protocol_family
432Filter by
433.Ar protocol_family .
434See
435.Sx GENERAL OPTIONS .
436.It Fl p Ar protocol
437Filter by
438.Ar protocol .
439See
440.Sx GENERAL OPTIONS .
441.It Fl M
442Use an alternative core.
443See
444.Sx GENERAL OPTIONS .
445.It Fl N
446Use an alternative kernel image
447See
448.Sx GENERAL OPTIONS .
449.It Fl j Ar jail
450Run inside a jail.
451See
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
465Display per-interface statistics for each network protocol.
466If both
467.Fl i
468and
469.Fl I
470are specified,
471.Fl I
472overrides any instances of
473.Fl i .
474.Bl -tag -width indent
475.It Fl 4
476Show IPv4 only
477See
478.Sx GENERAL OPTIONS .
479.It Fl 6
480Show IPv6 only
481See
482.Sx GENERAL OPTIONS .
483.It Fl s
484If
485.Fl s
486is repeated, counters with a value of zero are suppressed.
487.It Fl f Ar protocol_family
488Filter by
489.Ar protocol_family .
490See
491.Sx GENERAL OPTIONS .
492.It Fl p Ar protocol
493Filter by
494.Ar protocol .
495See
496.Sx GENERAL OPTIONS .
497.It Fl M
498Use an alternative core
499See
500.Sx GENERAL OPTIONS .
501.It Fl N
502Use an alternative kernel image
503See
504.Sx GENERAL OPTIONS .
505.It Fl j Ar jail
506Run inside a jail.
507See
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
519Show statistics recorded by the memory management routines
520.Pq Xr mbuf 9 .
521The network manages a private pool of memory buffers.
522.Bl -tag -width indent
523.It Fl M
524Use an alternative core
525See
526.Sx GENERAL OPTIONS .
527.It Fl N
528Use an alternative kernel image
529See
530.Sx GENERAL OPTIONS .
531.It Fl j Ar jail
532Run inside a jail.
533See
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
545Show statistics about
546.Xr bpf 4
547peers.
548This includes information like
549how many packets have been matched, dropped and received by the
550bpf device, also information about current buffer sizes and device
551states.
552.Pp
553The
554.Xr bpf 4
555flags displayed when
556.Nm
557is invoked with the
558.Fl B
559option represent the underlying parameters of the bpf peer.
560Each flag is
561represented as a single lower case letter.
562The 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
567filled automatically
568.It Li s Ta Dv BIOCGSEESENT No status: see packets originating locally and
569remotely 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
574For more information about these flags, please refer to
575.Xr bpf 4 .
576.Bl -tag -width indent
577.It Fl z
578Reset statistic counters after displaying them.
579.It Fl j Ar jail
580Run inside a jail.
581See
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
596Display the contents of routing tables.
597.Pp
598When
599.Nm
600is invoked with the routing table option
601.Fl r ,
602it lists the available routes and their status.
603Each route consists of a destination host or network, and a gateway to use
604in forwarding packets.
605The flags field shows a collection of information about the route stored
606as binary choices.
607The individual flags are discussed in more detail in the
608.Xr route 8
609and
610.Xr route 4
611manual pages.
612The 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
630Direct routes are created for each
631interface attached to the local host;
632the gateway field for such entries shows the address of the outgoing interface.
633The refcnt field gives the
634current number of active uses of the route.
635Connection oriented
636protocols normally hold on to a single route for the duration of
637a connection while connectionless protocols obtain a route while sending
638to the same destination.
639The use field provides a count of the number of packets
640sent using that route.
641The interface entry indicates the network interface utilized for the route.
642.Bl -tag -width indent
643.It Fl 4
644Show IPv4 only.
645See
646.Sx GENERAL OPTIONS .
647.It Fl 6
648Show IPv6 only.
649See
650.Sx GENERAL OPTIONS .
651.It Fl n
652Do not resolve numeric addresses and port numbers to names.
653See
654.Sx GENERAL OPTIONS .
655.It Fl W
656Show the path MTU for each route, and print interface names with a
657wider field size.
658.It Fl F
659Display the routing table with the number
660.Ar fibnum .
661If the specified
662.Ar fibnum
663is -1 or
664.Fl F
665is not specified,
666the default routing table is displayed.
667.It Fl f
668Display the routing table for a particular
669.Ar address_family .
670.It Fl M
671Use an alternative core
672See
673.Sx GENERAL OPTIONS .
674.It Fl N
675Use an alternative kernel image
676See
677.Sx GENERAL OPTIONS .
678.It Fl j Ar jail
679Run inside a jail.
680See
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
693Display routing statistics.
694.Bl -tag -width indent
695.It Fl s
696If
697.Fl s
698is repeated, counters with a value of zero are suppressed.
699.It Fl M
700Use an alternative core
701See
702.Sx GENERAL OPTIONS .
703.It Fl N
704Use an alternative kernel image
705See
706.Sx GENERAL OPTIONS .
707.It Fl j Ar jail
708Run inside a jail.
709See
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
723Display the contents of the multicast virtual interface tables,
724and multicast forwarding caches.
725Entries in these tables will appear only when the kernel is
726actively forwarding multicast sessions.
727This option is applicable only to the
728.Cm inet
729and
730.Cm inet6
731address families.
732.Bl -tag -width indent
733.It Fl 4
734Show IPv4 only
735See
736.Sx GENERAL OPTIONS .
737.It Fl 6
738Show IPv6 only
739See
740.Sx GENERAL OPTIONS .
741.It Fl W
742Avoid truncating addresses even if this causes some fields to overflow.
743.It Fl f Ar protocol_family
744Filter by
745.Ar protocol_family .
746See
747.Sx GENERAL OPTIONS .
748.It Fl M
749Use an alternative core
750See
751.Sx GENERAL OPTIONS .
752.It Fl N
753Use an alternative kernel image
754See
755.Sx GENERAL OPTIONS .
756.It Fl j Ar jail
757Run inside a jail.
758See
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
772Show multicast routing statistics.
773.Bl -tag -width indent
774.It Fl 4
775Show IPv4 only
776See
777.Sx GENERAL OPTIONS .
778.It Fl 6
779Show IPv6 only
780See
781.Sx GENERAL OPTIONS .
782.It Fl s
783If
784.Fl s
785is repeated, counters with a value of zero are suppressed.
786.It Fl f Ar protocol_family
787Filter by
788.Ar protocol_family .
789See
790.Sx GENERAL OPTIONS .
791.It Fl M
792Use an alternative core
793See
794.Sx GENERAL OPTIONS .
795.It Fl N
796Use an alternative kernel image
797See
798.Sx GENERAL OPTIONS .
799.It Fl j Ar jail
800Run inside a jail.
801See
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
811Show
812.Xr netisr 9
813statistics.
814The 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
820Run inside a jail.
821See
822.Sx GENERAL OPTIONS .
823.El
824.El
825.Ss GENERAL OPTIONS
826Some options have the general meaning:
827.Bl -tag -width flag
828.It Fl 4
829Is shorthand for
830.Fl f
831.Ar inet
832.Pq Show only IPv4
833.It Fl 6
834Is shorthand for
835.Fl f
836.Ar inet6
837.Pq Show only IPv6
838.It Fl f Ar address_family , Fl p Ar protocol
839Limit display to those records
840of the specified
841.Ar address_family
842or a single
843.Ar protocol .
844The 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
861The program will complain if
862.Ar protocol
863is unknown or if there is no statistics routine for it.
864.It Fl M
865Extract values associated with the name list from the specified core
866instead of the default
867.Pa /dev/kmem .
868.It Fl N
869Extract the name list from the specified system instead of the default,
870which is the kernel image the system has booted from.
871.It Fl n
872Show network addresses and ports as numbers.
873Normally
874.Nm
875attempts to resolve addresses and ports,
876and display them symbolically.
877.It Fl W
878Wider output; expand address fields, etc, to avoid truncation.
879Non-numeric values such as domain names may still be truncated; use the
880.Fl n
881option if necessary to avoid ambiguity.
882.It Fl j Ar jail
883Perform the actions inside the
884.Ar jail .
885This allows network state to be accessed even if the
886.Cm netstat
887binary is not available in the
888.Ar jail .
889.El
890.Sh EXAMPLES
891Show packet traffic information (packets, bytes, errors, packet drops, etc) for
892interface 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
897Show statistics for ICMP on any interface:
898.Bd -literal -offset indent
899$ netstat -s -p icmp
900.Ed
901.Pp
902Show routing tables:
903.Bd -literal -offset indent
904$ netstat -r
905.Ed
906.Pp
907Same as above, but without resolving numeric addresses and port numbers to
908names:
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
933The
934.Nm
935command appeared in
936.Bx 4.2 .
937.Pp
938IPv6 support was added by WIDE/KAME project.
939.Sh BUGS
940The notion of errors is ill-defined.
941