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