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