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