Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | .\" Copyright (c) 1983, 1990 The Regents of the University of California. |
2 | .\" 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. 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. | |
19 | .\" | |
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 | |
30 | .\" SUCH DAMAGE. | |
31 | .\" | |
32 | .\" @(#)netstat.1 6.14 (Berkeley) 7/27/91 | |
33 | .\" | |
34 | .Dd July 27, 1991 | |
35 | .Dt NETSTAT 1 | |
36 | .Os BSD 4.2 | |
37 | .Sh NAME | |
38 | .Nm netstat | |
39 | .Nd show network status | |
40 | .Sh SYNOPSIS | |
41 | .Nm netstat | |
42 | .Op Fl Aan | |
43 | .Op Fl f Ar address_family | |
44 | .Op Ar system | |
45 | .Op Ar core | |
46 | .Nm netstat | |
47 | .Op Fl himnrs | |
48 | .Op Fl f Ar address_family | |
49 | .Op Fl M Ar core | |
50 | .Op Fl N Ar system | |
51 | .Nm netstat | |
52 | .Op Fl n | |
53 | .Op Fl I Op Ar interface | |
54 | .Op Fl M Ar core | |
55 | .Op Fl N Ar system | |
56 | .Op Fl w Ar wait | |
57 | .Nm netstat | |
58 | .Op Fl p Ar protocol | |
59 | .Op Fl M Ar core | |
60 | .Op Fl N Ar system | |
61 | .Sh DESCRIPTION | |
62 | The | |
63 | .Nm netstat | |
64 | command symbolically displays the contents of various network-related | |
65 | data structures. | |
66 | There are a number of output formats, | |
67 | depending on the options for the information presented. | |
68 | The first form of the command displays a list of active sockets for | |
69 | each protocol. | |
70 | The second form presents the contents of one of the other network | |
71 | data structures according to the option selected. | |
72 | Using the third form, with a | |
73 | .Ar wait | |
74 | interval specified, | |
75 | .Nm netstat | |
76 | will continuously display the information regarding packet | |
77 | traffic on the configured network interfaces. | |
78 | The fourth form displays statistics about the named protocol. | |
79 | .Pp | |
80 | The options have the following meaning: | |
81 | .Bl -tag -width flag | |
82 | .It Fl A | |
83 | With the default display, | |
84 | show the address of any protocol control blocks associated with sockets; used | |
85 | for debugging. | |
86 | .It Fl a | |
87 | With the default display, | |
88 | show the state of all sockets; normally sockets used by | |
89 | server processes are not shown. | |
90 | .It Fl d | |
91 | With either interface display (option | |
92 | .Fl i | |
93 | or an interval, as described below), | |
94 | show the number of dropped packets. | |
95 | .It Fl h | |
96 | Show the state of the | |
97 | .Tn IMP | |
98 | host table. | |
99 | .It Fl i | |
100 | Show the state of interfaces which have been auto-configured | |
101 | (interfaces statically configured into a system, but not | |
102 | located at boot time are not shown). | |
103 | .It Fl I Ar interface | |
104 | Show information only about this interface; | |
105 | used with an | |
106 | .Ar wait | |
107 | interval as described below. | |
108 | .It Fl M | |
109 | Extract values associated with the name list from the specified core | |
110 | instead of the default | |
111 | .Pa /dev/kmem . | |
112 | .It Fl m | |
113 | Show statistics recorded by the memory management routines | |
114 | (the network manages a private pool of memory buffers). | |
115 | .It Fl N | |
116 | Extract the name list from the specified system instead of the default | |
117 | .Pa /vmunix . | |
118 | .It Fl n | |
119 | Show network addresses as numbers (normally | |
120 | .Nm netstat | |
121 | interprets addresses and attempts to display them | |
122 | symbolically). | |
123 | This option may be used with any of the display formats. | |
124 | .It Fl p Ar protocol | |
125 | Show statistics about | |
126 | .Ar protocol , | |
127 | which is either a well-known name for a protocol or an alias for it. Some | |
128 | protocol names and aliases are listed in the file | |
129 | .Pa /etc/protocols . | |
130 | A null response typically means that there are no interesting numbers to | |
131 | report. | |
132 | The program will complain if | |
133 | .Ar protocol | |
134 | is unknown or if there is no statistics routine for it. | |
135 | .It Fl s | |
136 | Show per-protocol statistics. | |
137 | .It Fl r | |
138 | Show the routing tables. | |
139 | When | |
140 | .Fl s | |
141 | is also present, show routing statistics instead. | |
142 | .It Fl f Ar address_family | |
143 | Limit statistics or address control block reports to those | |
144 | of the specified | |
145 | .Ar address family . | |
146 | The following address families | |
147 | are recognized: | |
148 | .Ar inet , | |
149 | for | |
150 | .Dv AF_INET , | |
151 | .Ar ns , | |
152 | for | |
153 | .Dv AF_NS , | |
154 | and | |
155 | .Ar unix , | |
156 | for | |
157 | .Dv AF_UNIX . | |
158 | .El | |
159 | .Pp | |
160 | The default display, for active sockets, shows the local | |
161 | and remote addresses, send and receive queue sizes (in bytes), protocol, | |
162 | and the internal state of the protocol. | |
163 | Address formats are of the form ``host.port'' or ``network.port'' | |
164 | if a socket's address specifies a network but no specific host address. | |
165 | When known the host and network addresses are displayed symbolically | |
166 | according to the data bases | |
167 | .Pa /etc/hosts | |
168 | and | |
169 | .Pa /etc/networks , | |
170 | respectively. If a symbolic name for an address is unknown, or if | |
171 | the | |
172 | .Fl n | |
173 | option is specified, the address is printed numerically, according | |
174 | to the address family. | |
175 | For more information regarding | |
176 | the Internet ``dot format,'' | |
177 | refer to | |
178 | .Xr inet 3 ) . | |
179 | Unspecified, | |
180 | or ``wildcard'', addresses and ports appear as ``*''. | |
181 | .Pp | |
182 | The interface display provides a table of cumulative | |
183 | statistics regarding packets transferred, errors, and collisions. | |
184 | The network addresses of the interface | |
185 | and the maximum transmission unit (``mtu'') are also displayed. | |
186 | .Pp | |
187 | The routing table display indicates the available routes and | |
188 | their status. Each route consists of a destination host or network | |
189 | and a gateway to use in forwarding packets. The flags field shows | |
190 | the state of the route (``U'' if ``up''), whether the route | |
191 | is to a gateway (``G''), whether the route was created dynamically | |
192 | by a redirect (``D''), and whether the route has been modified | |
193 | by a redirect (``M''). Direct routes are created for each | |
194 | interface attached to the local host; | |
195 | the gateway field for such entries shows the address of the outgoing interface. | |
196 | The refcnt field gives the | |
197 | current number of active uses of the route. Connection oriented | |
198 | protocols normally hold on to a single route for the duration of | |
199 | a connection while connectionless protocols obtain a route while sending | |
200 | to the same destination. | |
201 | The use field provides a count of the number of packets | |
202 | sent using that route. The interface entry indicates the network | |
203 | interface utilized for the route. | |
204 | .Pp | |
205 | When | |
206 | .Nm netstat | |
207 | is invoked with a | |
208 | .Ar wait | |
209 | interval argument, it displays a running count of statistics related to | |
210 | network interfaces. | |
211 | This display consists of a column for the primary interface (the first | |
212 | interface found during autoconfiguration) and a column summarizing | |
213 | information for all interfaces. | |
214 | The primary interface may be replaced with another interface with the | |
215 | .Fl I | |
216 | option. | |
217 | The first line of each screen of information contains a summary since the | |
218 | system was last rebooted. Subsequent lines of output show values | |
219 | accumulated over the preceding interval. | |
220 | .Sh SEE ALSO | |
221 | .Xr iostat 1 , | |
222 | .Xr nfsstat 1 , | |
223 | .Xr ps 1 , | |
224 | .Xr vmstat 1 , | |
225 | .Xr hosts 5 , | |
226 | .Xr networks 5 , | |
227 | .Xr protocols 5 , | |
228 | .Xr services 5 , | |
229 | .Xr trpt 8 , | |
230 | .Xr trsp 8 | |
231 | .Sh HISTORY | |
232 | The | |
233 | .Nm netstat | |
234 | command appeared in | |
235 | .Bx 4.2 . | |
236 | .\" .Sh FILES | |
237 | .\" .Bl -tag -width /dev/kmem -compact | |
238 | .\" .It Pa /vmunix | |
239 | .\" default kernel namelist | |
240 | .\" .It Pa /dev/kmem | |
241 | .\" default memory file | |
242 | .\" .El | |
243 | .Sh BUGS | |
244 | The notion of errors is ill-defined. | |
245 | .Pp | |
246 | Collisions mean something else for the | |
247 | .Tn IMP . |