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