]>
Commit | Line | Data |
---|---|---|
b7080c8e A |
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. 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 8.8 (Berkeley) 4/18/94 | |
33 | .\" | |
34 | .Dd April 18, 1994 | |
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 Fl M Ar core | |
45 | .Op Fl N Ar system | |
46 | .Nm netstat | |
47 | .Op Fl dghimnrs | |
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 dn | |
53 | .Op Fl I 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 f Ar address_family | |
96 | Limit statistics or address control block reports to those | |
97 | of the specified | |
98 | .Ar address family . | |
99 | The following address families | |
100 | are recognized: | |
101 | .Ar inet , | |
102 | for | |
103 | .Dv AF_INET , | |
104 | .Ar ns , | |
105 | for | |
106 | .Dv AF_NS , | |
107 | .Ar iso , | |
108 | for | |
109 | .Dv AF_ISO , | |
110 | and | |
111 | .Ar unix , | |
112 | for | |
113 | .Dv AF_UNIX . | |
114 | .It Fl g | |
115 | Show information related to multicast (group address) routing. | |
116 | By default, show the IP Multicast virtual-interface and routing tables. | |
117 | If the | |
118 | .Fl s | |
119 | option is also present, show multicast routing statistics. | |
120 | .It Fl h | |
121 | Show the state of the | |
122 | .Tn IMP | |
123 | host table (obsolete). | |
124 | .It Fl I Ar interface | |
125 | Show information about the specified interface; | |
126 | used with a | |
127 | .Ar wait | |
128 | interval as described below. | |
129 | .It Fl i | |
130 | Show the state of interfaces which have been auto-configured | |
131 | (interfaces statically configured into a system, but not | |
132 | located at boot time are not shown). | |
133 | If the | |
134 | .Fl a | |
135 | options is also present, multicast addresses currently in use are shown | |
136 | for each Ethernet interface and for each IP interface address. | |
137 | Multicast addresses are shown on separate lines following the interface | |
138 | address with which they are associated. | |
139 | .It Fl M | |
140 | Extract values associated with the name list from the specified core | |
141 | instead of the default | |
142 | .Pa /dev/kmem . | |
143 | .It Fl m | |
144 | Show statistics recorded by the memory management routines | |
145 | (the network manages a private pool of memory buffers). | |
146 | .It Fl N | |
147 | Extract the name list from the specified system instead of the default | |
148 | .Pa /vmunix . | |
149 | .It Fl n | |
150 | Show network addresses as numbers (normally | |
151 | .Nm netstat | |
152 | interprets addresses and attempts to display them | |
153 | symbolically). | |
154 | This option may be used with any of the display formats. | |
155 | .It Fl p Ar protocol | |
156 | Show statistics about | |
157 | .Ar protocol , | |
158 | which is either a well-known name for a protocol or an alias for it. Some | |
159 | protocol names and aliases are listed in the file | |
160 | .Pa /etc/protocols . | |
161 | A null response typically means that there are no interesting numbers to | |
162 | report. | |
163 | The program will complain if | |
164 | .Ar protocol | |
165 | is unknown or if there is no statistics routine for it. | |
166 | .It Fl s | |
167 | Show per-protocol statistics. | |
168 | If this option is repeated, counters with a value of zero are suppressed. | |
169 | .It Fl r | |
170 | Show the routing tables. | |
171 | When | |
172 | .Fl s | |
173 | is also present, show routing statistics instead. | |
174 | .It Fl w Ar wait | |
175 | Show network interface statistics at intervals of | |
176 | .Ar wait | |
177 | seconds. | |
178 | .El | |
179 | .Pp | |
180 | The default display, for active sockets, shows the local | |
181 | and remote addresses, send and receive queue sizes (in bytes), protocol, | |
182 | and the internal state of the protocol. | |
183 | Address formats are of the form ``host.port'' or ``network.port'' | |
184 | if a socket's address specifies a network but no specific host address. | |
185 | When known the host and network addresses are displayed symbolically | |
186 | according to the data bases | |
187 | .Pa /etc/hosts | |
188 | and | |
189 | .Pa /etc/networks , | |
190 | respectively. If a symbolic name for an address is unknown, or if | |
191 | the | |
192 | .Fl n | |
193 | option is specified, the address is printed numerically, according | |
194 | to the address family. | |
195 | For more information regarding | |
196 | the Internet ``dot format,'' | |
197 | refer to | |
198 | .Xr inet 3 ) . | |
199 | Unspecified, | |
200 | or ``wildcard'', addresses and ports appear as ``*''. | |
201 | .Pp | |
202 | The interface display provides a table of cumulative | |
203 | statistics regarding packets transferred, errors, and collisions. | |
204 | The network addresses of the interface | |
205 | and the maximum transmission unit (``mtu'') are also displayed. | |
206 | .Pp | |
207 | The routing table display indicates the available routes and | |
208 | their status. Each route consists of a destination host or network | |
209 | and a gateway to use in forwarding packets. The flags field shows | |
210 | a collection of information about the route stored as | |
211 | binary choices. The individual flags are discussed in more | |
212 | detail in the | |
213 | .Xr route 8 | |
214 | and | |
215 | .Xr route 4 | |
216 | manual pages. | |
217 | The mapping between letters and flags is: | |
218 | .Bl -column XXXX RTF_BLACKHOLE | |
219 | 1 RTF_PROTO2 Protocol specific routing flag #1 | |
220 | 2 RTF_PROTO1 Protocol specific routing flag #2 | |
221 | B RTF_BLACKHOLE Just discard pkts (during updates) | |
222 | C RTF_CLONING Generate new routes on use | |
223 | D RTF_DYNAMIC Created dynamically (by redirect) | |
224 | G RTF_GATEWAY Destination requires forwarding by intermediary | |
225 | H RTF_HOST Host entry (net otherwise) | |
226 | L RTF_LLINFO Valid protocol to link address translation. | |
227 | M RTF_MODIFIED Modified dynamically (by redirect) | |
228 | R RTF_REJECT Host or net unreachable | |
229 | S RTF_STATIC Manually added | |
230 | U RTF_UP Route usable | |
231 | X RTF_XRESOLVE External daemon translates proto to link address | |
232 | .El | |
233 | .Pp | |
234 | Direct routes are created for each | |
235 | interface attached to the local host; | |
236 | the gateway field for such entries shows the address of the outgoing interface. | |
237 | The refcnt field gives the | |
238 | current number of active uses of the route. Connection oriented | |
239 | protocols normally hold on to a single route for the duration of | |
240 | a connection while connectionless protocols obtain a route while sending | |
241 | to the same destination. | |
242 | The use field provides a count of the number of packets | |
243 | sent using that route. The interface entry indicates the network | |
244 | interface utilized for the route. | |
245 | .Pp | |
246 | When | |
247 | .Nm netstat | |
248 | is invoked with the | |
249 | .Fl w | |
250 | option and a | |
251 | .Ar wait | |
252 | interval argument, it displays a running count of statistics related to | |
253 | network interfaces. | |
254 | An obsolescent version of this option used a numeric parameter | |
255 | with no option, and is currently supported for backward compatibility. | |
256 | This display consists of a column for the primary interface (the first | |
257 | interface found during autoconfiguration) and a column summarizing | |
258 | information for all interfaces. | |
259 | The primary interface may be replaced with another interface with the | |
260 | .Fl I | |
261 | option. | |
262 | The first line of each screen of information contains a summary since the | |
263 | system was last rebooted. Subsequent lines of output show values | |
264 | accumulated over the preceding interval. | |
265 | .Sh SEE ALSO | |
266 | .Xr iostat 1 , | |
267 | .Xr nfsstat 1 , | |
268 | .Xr ps 1 , | |
269 | .Xr vmstat 1 , | |
270 | .Xr hosts 5 , | |
271 | .Xr networks 5 , | |
272 | .Xr protocols 5 , | |
273 | .Xr services 5 , | |
274 | .Xr trpt 8 , | |
275 | .Xr trsp 8 | |
276 | .Sh HISTORY | |
277 | The | |
278 | .Nm netstat | |
279 | command appeared in | |
280 | .Bx 4.2 . | |
281 | .\" .Sh FILES | |
282 | .\" .Bl -tag -width /dev/kmem -compact | |
283 | .\" .It Pa /vmunix | |
284 | .\" default kernel namelist | |
285 | .\" .It Pa /dev/kmem | |
286 | .\" default memory file | |
287 | .\" .El | |
288 | .Sh BUGS | |
289 | The notion of errors is ill-defined. |