Commit | Line | Data |
---|---|---|
b5dc1377 | 1 | .\" Copyright (c) 1983, 1990 The Regents of the University of California. |
ac63c3f4 | 2 | .\" All rights reserved. |
93874d5d | 3 | .\" |
1c15e888 C |
4 | .\" Redistribution and use in source and binary forms are permitted provided |
5 | .\" that: (1) source distributions retain this entire copyright notice and | |
6 | .\" comment, and (2) distributions including binaries display the following | |
7 | .\" acknowledgement: ``This product includes software developed by the | |
8 | .\" University of California, Berkeley and its contributors'' in the | |
9 | .\" documentation or other materials provided with the distribution and in | |
10 | .\" all advertising materials mentioning features or use of this software. | |
11 | .\" Neither the name of the University nor the names of its contributors may | |
12 | .\" be used to endorse or promote products derived from this software without | |
13 | .\" specific prior written permission. | |
14 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | |
15 | .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | |
16 | .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
ac63c3f4 | 17 | .\" |
1c15e888 | 18 | .\" @(#)netstat.1 6.11 (Berkeley) 7/24/90 |
93874d5d | 19 | .\" |
1c15e888 | 20 | .Dd July 24, 1990 |
b5dc1377 CL |
21 | .Dt NETSTAT 1 |
22 | .Os BSD 4.2 | |
23 | .Sh NAME | |
24 | .Nm netstat | |
25 | .Nd show network status | |
26 | .Sh SYNOPSIS | |
27 | .Nm netstat | |
28 | .Op Fl Aan | |
dd9e2e8d | 29 | .Op Fl f Ar address_family |
b5dc1377 CL |
30 | .Op Ar system |
31 | .Op Ar core | |
32 | .Nm netstat | |
33 | .Op Fl himnrs | |
34 | .Op Fl f Ar address_family | |
35 | .Op Ar system | |
36 | .Op Ar core | |
37 | .Nm netstat | |
38 | .Op Fl n | |
39 | .Op Fl I Op Ar interface | |
40 | .Ar interval | |
41 | .Op Ar system | |
42 | .Op Ar core | |
43 | .Nm netstat | |
44 | .Op Fl p Ar protocol | |
45 | .Op Ar system | |
46 | .Op Ar core | |
47 | .Sh DESCRIPTION | |
93874d5d | 48 | The |
b5dc1377 | 49 | .Nm netstat |
93874d5d | 50 | command symbolically displays the contents of various network-related |
84efacbd MK |
51 | data structures. |
52 | There are a number of output formats, | |
53 | depending on the options for the information presented. | |
54 | The first form of the command displays a list of active sockets for | |
55 | each protocol. | |
56 | The second form presents the contents of one of the other network | |
57 | data structures according to the option selected. | |
b5dc1377 CL |
58 | Using the third form, with an |
59 | .Ar interval | |
84efacbd | 60 | specified, |
b5dc1377 | 61 | .Nm netstat |
84efacbd MK |
62 | will continuously display the information regarding packet |
63 | traffic on the configured network interfaces. | |
57d17fbd | 64 | The fourth form displays statistics about the named protocol. |
b5dc1377 | 65 | .Pp |
84efacbd | 66 | The options have the following meaning: |
b5dc1377 CL |
67 | .Tw Fl |
68 | .Tp Fl A | |
84efacbd MK |
69 | With the default display, |
70 | show the address of any protocol control blocks associated with sockets; used | |
71 | for debugging. | |
b5dc1377 | 72 | .Tp Fl a |
84efacbd | 73 | With the default display, |
93874d5d | 74 | show the state of all sockets; normally sockets used by |
84efacbd | 75 | server processes are not shown. |
5325ced3 | 76 | .Tp Fl d |
77560d37 | 77 | With either interface display (option |
b5dc1377 | 78 | .Fl i |
77560d37 MK |
79 | or an interval, as described below), |
80 | show the number of dropped packets. | |
b5dc1377 | 81 | .Tp Fl h |
84efacbd | 82 | Show the state of the IMP host table. |
b5dc1377 | 83 | .Tp Fl i |
84efacbd | 84 | Show the state of interfaces which have been auto-configured |
93874d5d | 85 | (interfaces statically configured into a system, but not |
84efacbd | 86 | located at boot time are not shown). |
b5dc1377 CL |
87 | .Tp Cx Fl I |
88 | .Ws | |
89 | .Ar interface | |
90 | .Cx | |
84efacbd MK |
91 | Show information only about this interface; |
92 | used with an | |
b5dc1377 | 93 | .Ar interval |
84efacbd | 94 | as described below. |
b5dc1377 | 95 | .Tp Fl m |
84efacbd MK |
96 | Show statistics recorded by the memory management routines |
97 | (the network manages a private pool of memory buffers). | |
b5dc1377 CL |
98 | .Tp Fl n |
99 | Show network addresses as numbers (normally | |
100 | .Nm netstat | |
93874d5d | 101 | interprets addresses and attempts to display them |
84efacbd MK |
102 | symbolically). |
103 | This option may be used with any of the display formats. | |
b5dc1377 CL |
104 | .Tp Cx Fl p |
105 | .Ws | |
106 | .Ar protocol | |
107 | .Cx | |
108 | Show statistics about | |
109 | .Ar protocol , | |
57d17fbd | 110 | which is either a well-known name for a protocol or an alias for it. Some |
b5dc1377 CL |
111 | protocol names and aliases are listed in the file |
112 | .Pa /etc/protocols . | |
113 | A null response typically means that there are no interesting numbers to | |
57d17fbd MK |
114 | report. |
115 | The program will complain if | |
b5dc1377 | 116 | .Ar protocol |
57d17fbd | 117 | is unknown or if there is no statistics routine for it. |
b5dc1377 | 118 | .Tp Fl s |
84efacbd | 119 | Show per-protocol statistics. |
b5dc1377 | 120 | .Tp Fl r |
84efacbd MK |
121 | Show the routing tables. |
122 | When | |
b5dc1377 | 123 | .Fl s |
84efacbd | 124 | is also present, show routing statistics instead. |
b5dc1377 CL |
125 | .Tp Cx Fl f |
126 | .Ws | |
127 | .Ar address_family | |
128 | .Cx | |
84efacbd | 129 | Limit statistics or address control block reports to those |
114898a7 | 130 | of the specified |
b5dc1377 | 131 | .Ar address family . |
84efacbd MK |
132 | The following address families |
133 | are recognized: | |
b5dc1377 | 134 | .Ar inet , |
114898a7 | 135 | for |
5325ced3 | 136 | .Li AF_INET , |
b5dc1377 | 137 | .Ar ns , |
114898a7 | 138 | for |
5325ced3 | 139 | .Li AF_NS , |
84efacbd | 140 | and |
b5dc1377 | 141 | .Ar unix , |
84efacbd | 142 | for |
5325ced3 | 143 | .Li AF_UNIX . |
b5dc1377 CL |
144 | .Tp |
145 | .Pp | |
146 | The arguments, | |
147 | .Ar system | |
93874d5d | 148 | and |
b5dc1377 CL |
149 | .Ar core |
150 | allow substitutes for the defaults | |
151 | .Dq Pa vmunix | |
152 | and | |
153 | .Dq Pa /dev/kmem . | |
154 | .Pp | |
84efacbd | 155 | The default display, for active sockets, shows the local |
93874d5d | 156 | and remote addresses, send and receive queue sizes (in bytes), protocol, |
84efacbd | 157 | and the internal state of the protocol. |
93874d5d KM |
158 | Address formats are of the form ``host.port'' or ``network.port'' |
159 | if a socket's address specifies a network but no specific host address. | |
160 | When known the host and network addresses are displayed symbolically | |
161 | according to the data bases | |
b5dc1377 | 162 | .Pa /etc/hosts |
93874d5d | 163 | and |
b5dc1377 | 164 | .Pa /etc/networks , |
93874d5d | 165 | respectively. If a symbolic name for an address is unknown, or if |
b5dc1377 CL |
166 | the |
167 | .Fl n | |
84efacbd MK |
168 | option is specified, the address is printed numerically, according |
169 | to the address family. | |
b5dc1377 | 170 | For more information regarding |
84efacbd | 171 | the Internet ``dot format,'' |
b5dc1377 CL |
172 | refer to |
173 | .Xr inet 3 ) . | |
93874d5d | 174 | Unspecified, |
b5dc1377 CL |
175 | or ``wildcard'', addresses and ports appear as ``*''. |
176 | .Pp | |
93874d5d KM |
177 | The interface display provides a table of cumulative |
178 | statistics regarding packets transferred, errors, and collisions. | |
84efacbd | 179 | The network addresses of the interface |
93874d5d | 180 | and the maximum transmission unit (``mtu'') are also displayed. |
b5dc1377 | 181 | .Pp |
93874d5d KM |
182 | The routing table display indicates the available routes and |
183 | their status. Each route consists of a destination host or network | |
184 | and a gateway to use in forwarding packets. The flags field shows | |
84efacbd | 185 | the state of the route (``U'' if ``up''), whether the route |
77560d37 MK |
186 | is to a gateway (``G''), whether the route was created dynamically |
187 | by a redirect (``D''), and whether the route has been modified | |
188 | by a redirect (``M''). Direct routes are created for each | |
84efacbd MK |
189 | interface attached to the local host; |
190 | the gateway field for such entries shows the address of the outgoing interface. | |
191 | The refcnt field gives the | |
93874d5d KM |
192 | current number of active uses of the route. Connection oriented |
193 | protocols normally hold on to a single route for the duration of | |
84efacbd MK |
194 | a connection while connectionless protocols obtain a route while sending |
195 | to the same destination. | |
196 | The use field provides a count of the number of packets | |
93874d5d KM |
197 | sent using that route. The interface entry indicates the network |
198 | interface utilized for the route. | |
b5dc1377 CL |
199 | .Pp |
200 | When | |
201 | .Nm netstat | |
93874d5d | 202 | is invoked with an |
b5dc1377 | 203 | .Ar interval |
93874d5d | 204 | argument, it displays a running count of statistics related to |
84efacbd MK |
205 | network interfaces. This display consists of a |
206 | column for the primary interface | |
207 | (the first interface found during autoconfiguration) | |
208 | and a column summarizing | |
209 | information for all interfaces. | |
210 | The primary interface may be replaced with another interface with the | |
b5dc1377 | 211 | .Fl I |
84efacbd MK |
212 | option. |
213 | The first line of each screen of information contains a summary since the | |
93874d5d KM |
214 | system was last rebooted. Subsequent lines of output show values |
215 | accumulated over the preceding interval. | |
b5dc1377 CL |
216 | .Sh SEE ALSO |
217 | .Xr iostat 1 , | |
218 | .Xr vmstat 1 , | |
219 | .Xr hosts 5 , | |
220 | .Xr networks 5 , | |
221 | .Xr protocols 5 , | |
222 | .Xr services 5 , | |
223 | .Xr trpt 8 | |
224 | .Sh HISTORY | |
225 | .Nm Netstat | |
226 | appeared in 4.2 BSD. | |
227 | .Sh BUGS | |
93874d5d KM |
228 | The notion of errors is ill-defined. Collisions mean |
229 | something else for the IMP. |