1 .\" Copyright (c) 1983, 1990, 1992, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94
33 .\" $FreeBSD: src/usr.bin/netstat/netstat.1,v 1.22.2.7 2001/08/10 09:07:09 ru Exp $
40 .Nd show network status
44 .Op Fl f Ar address_family | Fl p Ar protocol
47 .Op Fl f Ar address_family
49 .Fl i | I Ar interface
54 .Op Fl f Ar address_family | Fl p Ar protocol
57 .Fl i | I Ar interface Fl s
58 .Op Fl f Ar address_family | Fl p Ar protocol
65 .Op Fl f Ar address_family
69 .\"-----------------------------------------------------------------------------------------
71 .\"-----------------------------------------------------------------------------------------
74 command symbolically displays the contents of various network-related data structures.
75 There are a number of output formats, depending on the options for the information presented.
76 The first form of the command displays a list of active sockets for each protocol.
77 The second form presents the contents of one of the other network data structures according
78 to the option selected. Using the third form, with a
82 will continuously display the information regarding packet traffic on the configured network
83 interfaces. The fourth form displays statistics for the specified protocol or address family. If a
85 interval is specified, the protocol information over the last interval seconds will be displayed.
86 The fifth form displays per-interface statistics for the specified protocol or address family.
87 The sixth form displays
89 statistics. The seventh form displays routing table for the specified address family. The
90 eighth form displays routing statistics.
92 The options have the following meaning:
95 With the default display, show the address of any protocol control blocks associated with
96 sockets; used for debugging.
98 With the default display, show the state of all sockets; normally sockets used by server
99 processes are not shown. With the routing table display (option
101 as described below), show protocol-cloned routes (routes generated by a
103 parent route); normally these routes are not shown.
105 With the interface display (option
107 as described below), show the number of bytes in and out.
109 With either interface display (option
111 or an interval, as described below), show the number of dropped packets.
112 .It Fl f Ar address_family
113 Limit statistics or address control block reports to those of the specified
115 The following address families are recognized:
127 Show information related to multicast (group address) routing. By default, show the
128 IP Multicast virtual-interface and routing tables. If the
130 option is also present, show multicast routing statistics.
131 .It Fl I Ar interface
132 Show information about the specified interface; used with a
134 interval as described below.
137 option is present, show per-interface protocol statistics on the
143 or for all protocol families.
145 Show the state of interfaces which have been auto-configured (interfaces statically
146 configured into a system, but not located at boot time are not shown). If the
148 options is also present, multicast addresses currently in use are shown for each
149 Ethernet interface and for each IP interface address. Multicast addresses are shown
150 on separate lines following the interface address with which they are associated.
153 option is present, show per-interface statistics on all interfaces for the specified
157 or for all protocol families.
159 Show the size of the various listen queues. The first count shows the number of
160 unaccepted connections. The second count shows the amount of unaccepted incomplete
161 connections. The third count is the maximum number of queued connections.
163 Print full IPv6 address.
165 Show statistics recorded by the memory management routines (the network stack manages a private pool of memory buffers). More detailed information about the buffers, which includes their cache related statistics, can be obtained by using
172 Show network addresses as numbers (normally
174 interprets addresses and attempts to display them symbolically). This option may be
175 used with any of the display formats.
177 Show statistics about
179 which is either a well-known name for a protocol or an alias for it. Some protocol
180 names and aliases are listed in the file
182 The special protocol name
184 is used to show bridging statistics. A null response typically means that there are
185 no interesting numbers to report. The program will complain if
187 is unknown or if there is no statistics routine for it.
189 Show the routing tables. Use with
191 to show protocol-cloned routes. When
193 is also present, show routing statistics instead. When
197 assumes more columns are there and the maximum transmission unit
201 Show per-protocol statistics. If this option is repeated, counters with a value of
204 In certain displays, avoid truncating addresses even if this causes some fields to
207 Show network interface or protocol statistics at intervals of
212 .\"-------------------------------------------------------------------------------
214 .\"-------------------------------------------------------------------------------
215 The default display, for active sockets, shows the local and remote addresses,
216 send and receive queue sizes (in bytes), protocol, and the internal state of
217 the protocol. Address formats are of the form
221 if a socket's address specifies a network but no specific host address.
222 If known, the host and network addresses are displayed symbolically
223 according to the databases
227 respectively. If a symbolic name for an address is unknown, or if the
229 option is specified, the address is printed numerically, according to the
230 address family. For more information regarding the Internet
237 addresses and ports appear as
240 Internet domain socket states:
242 CLOSED: The socket is not in use.
244 LISTEN: The socket is listening for incoming connections. Unconnected
245 listening sockets like these are only displayed when using the -a option.
247 SYN_SENT: The socket is actively trying to establish a connection to a
250 SYN_RCVD: The socket has passively received a connection request from a
253 ESTABLISHED: The socket has an established connection between a local
254 application and a remote peer.
256 CLOSE_WAIT: The socket connection has been closed by the remote peer,
257 and the system is waiting for the local application to close its half of
260 LAST_ACK: The socket connection has been closed by the remote peer, the
261 local application has closed its half of the connection, and the system
262 is waiting for the remote peer to acknowledge the close.
264 FIN_WAIT_1: The socket connection has been closed by the local
265 application, the remote peer has not yet acknowledged the close, and the
266 system is waiting for it to close its half of the connection.
268 FIN_WAIT_2: The socket connection has been closed by the local
269 application, the remote peer has acknowledged the close, and the system
270 is waiting for it to close its half of the connection.
272 CLOSING: The socket connection has been closed by the local application
273 and the remote peer simultaneously, and the remote peer has not yet
274 acknowledged the close attempt of the local application.
276 TIME_WAIT: The socket connection has been closed by the local
277 application, the remote peer has closed its half of the connection, and
278 the system is waiting to be sure that the remote peer received the last
282 The interface display provides a table of cumulative statistics regarding
283 packets transferred, errors, and collisions. The network addresses of the
284 interface and the maximum transmission unit
288 The routing table display indicates the available routes and their status.
289 Each route consists of a destination host or network and a gateway to use
290 in forwarding packets. The flags field shows a collection of information
291 about the route stored as binary choices. The individual flags are discussed
292 in more detail in the
296 manual pages. The mapping between letters and flags is:
297 .Bl -column XXXX RTF_BLACKHOLE
298 1 RTF_PROTO1 Protocol specific routing flag #1
299 2 RTF_PROTO2 Protocol specific routing flag #2
300 3 RTF_PROTO3 Protocol specific routing flag #3
301 B RTF_BLACKHOLE Just discard packets (during updates)
302 b RTF_BROADCAST The route represents a broadcast address
303 C RTF_CLONING Generate new routes on use
304 c RTF_PRCLONING Protocol-specified generate new routes on use
305 D RTF_DYNAMIC Created dynamically (by redirect)
306 G RTF_GATEWAY Destination requires forwarding by intermediary
307 H RTF_HOST Host entry (net otherwise)
308 I RTF_IFSCOPE Route is associated with an interface scope
309 L RTF_LLINFO Valid protocol to link address translation
310 M RTF_MODIFIED Modified dynamically (by redirect)
311 m RTF_MULTICAST The route represents a multicast address
312 R RTF_REJECT Host or net unreachable
313 S RTF_STATIC Manually added
314 U RTF_UP Route usable
315 W RTF_WASCLONED Route was generated as a result of cloning
316 X RTF_XRESOLVE External daemon translates proto to link address
319 Direct routes are created for each interface attached to the local host;
320 the gateway field for such entries shows the address of the outgoing
321 interface. The refcnt field gives the current number of active uses of
322 the route. Connection oriented protocols normally hold on to a single
323 route for the duration of a connection while connectionless protocols
324 obtain a route while sending to the same destination. The use field
325 provides a count of the number of packets sent using that route. The
326 interface entry indicates the network interface utilized for the route.
327 A route which is marked with the RTF_IFSCOPE flag is instantiated for
328 the corresponding interface.
336 interval argument, it displays a running count of statistics related to
337 network interfaces or protocols. An obsolete version of this option used a numeric
338 parameter with no option, and is currently supported for backward
339 compatibility. By default, this display summarizes information for all
340 interfaces. Information for a specific interface may be displayed with the
364 IPv6 support was added by WIDE/KAME project.
366 The notion of errors is ill-defined.