Commit | Line | Data |
---|---|---|
d0a28d80 | 1 | .\" Copyright (c) 1983, 1990, 1992 The Regents of the University of California. |
ac63c3f4 | 2 | .\" All rights reserved. |
93874d5d | 3 | .\" |
263cc8fc | 4 | .\" %sccs.include.redist.roff% |
ac63c3f4 | 5 | .\" |
2839532b | 6 | .\" @(#)netstat.1 8.1 (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 | |
d0a28d80 | 16 | .Op Fl ABan |
dd9e2e8d | 17 | .Op Fl f Ar address_family |
b5dc1377 CL |
18 | .Op Ar system |
19 | .Op Ar core | |
20 | .Nm netstat | |
d0a28d80 | 21 | .Op Fl Bhimnrs |
b5dc1377 | 22 | .Op Fl f Ar address_family |
c4f5a622 KB |
23 | .Op Fl M Ar core |
24 | .Op Fl N Ar system | |
b5dc1377 CL |
25 | .Nm netstat |
26 | .Op Fl n | |
27 | .Op Fl I Op 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. | |
d0a28d80 KS |
60 | .It Fl B |
61 | With the default display, | |
62 | show the multicast routing tables. | |
63 | When | |
64 | .Fl s | |
65 | is also present, show multicast routing statistics instead. | |
263cc8fc | 66 | .It Fl a |
84efacbd | 67 | With the default display, |
93874d5d | 68 | show the state of all sockets; normally sockets used by |
84efacbd | 69 | server processes are not shown. |
263cc8fc | 70 | .It Fl d |
77560d37 | 71 | With either interface display (option |
b5dc1377 | 72 | .Fl i |
77560d37 MK |
73 | or an interval, as described below), |
74 | show the number of dropped packets. | |
263cc8fc CL |
75 | .It Fl h |
76 | Show the state of the | |
77 | .Tn IMP | |
78 | host table. | |
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). |
d0a28d80 | 83 | .It Fl I Ar interface |
84efacbd MK |
84 | Show information only about this interface; |
85 | used with an | |
c4f5a622 KB |
86 | .Ar wait |
87 | interval as described below. | |
263cc8fc | 88 | .It Fl M |
c4f5a622 KB |
89 | Extract values associated with the name list from the specified core |
90 | instead of the default | |
91 | .Pa /dev/kmem . | |
263cc8fc | 92 | .It Fl m |
84efacbd MK |
93 | Show statistics recorded by the memory management routines |
94 | (the network manages a private pool of memory buffers). | |
263cc8fc | 95 | .It Fl N |
c4f5a622 KB |
96 | Extract the name list from the specified system instead of the default |
97 | .Pa /vmunix . | |
263cc8fc | 98 | .It Fl n |
b5dc1377 CL |
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. | |
d0a28d80 | 104 | .It Fl p Ar protocol |
b5dc1377 CL |
105 | Show statistics about |
106 | .Ar protocol , | |
57d17fbd | 107 | which is either a well-known name for a protocol or an alias for it. Some |
b5dc1377 CL |
108 | protocol names and aliases are listed in the file |
109 | .Pa /etc/protocols . | |
110 | A null response typically means that there are no interesting numbers to | |
57d17fbd MK |
111 | report. |
112 | The program will complain if | |
b5dc1377 | 113 | .Ar protocol |
57d17fbd | 114 | is unknown or if there is no statistics routine for it. |
263cc8fc | 115 | .It Fl s |
84efacbd | 116 | Show per-protocol statistics. |
263cc8fc | 117 | .It Fl r |
84efacbd MK |
118 | Show the routing tables. |
119 | When | |
b5dc1377 | 120 | .Fl s |
84efacbd | 121 | is also present, show routing statistics instead. |
d0a28d80 | 122 | .It Fl f Ar address_family |
84efacbd | 123 | Limit statistics or address control block reports to those |
114898a7 | 124 | of the specified |
b5dc1377 | 125 | .Ar address family . |
84efacbd MK |
126 | The following address families |
127 | are recognized: | |
b5dc1377 | 128 | .Ar inet , |
114898a7 | 129 | for |
263cc8fc | 130 | .Dv AF_INET , |
b5dc1377 | 131 | .Ar ns , |
114898a7 | 132 | for |
263cc8fc | 133 | .Dv AF_NS , |
84efacbd | 134 | and |
b5dc1377 | 135 | .Ar unix , |
84efacbd | 136 | for |
263cc8fc CL |
137 | .Dv AF_UNIX . |
138 | .El | |
b5dc1377 | 139 | .Pp |
84efacbd | 140 | The default display, for active sockets, shows the local |
93874d5d | 141 | and remote addresses, send and receive queue sizes (in bytes), protocol, |
84efacbd | 142 | and the internal state of the protocol. |
93874d5d KM |
143 | Address formats are of the form ``host.port'' or ``network.port'' |
144 | if a socket's address specifies a network but no specific host address. | |
145 | When known the host and network addresses are displayed symbolically | |
146 | according to the data bases | |
b5dc1377 | 147 | .Pa /etc/hosts |
93874d5d | 148 | and |
b5dc1377 | 149 | .Pa /etc/networks , |
93874d5d | 150 | respectively. If a symbolic name for an address is unknown, or if |
b5dc1377 CL |
151 | the |
152 | .Fl n | |
84efacbd MK |
153 | option is specified, the address is printed numerically, according |
154 | to the address family. | |
b5dc1377 | 155 | For more information regarding |
84efacbd | 156 | the Internet ``dot format,'' |
b5dc1377 CL |
157 | refer to |
158 | .Xr inet 3 ) . | |
93874d5d | 159 | Unspecified, |
b5dc1377 CL |
160 | or ``wildcard'', addresses and ports appear as ``*''. |
161 | .Pp | |
93874d5d KM |
162 | The interface display provides a table of cumulative |
163 | statistics regarding packets transferred, errors, and collisions. | |
84efacbd | 164 | The network addresses of the interface |
93874d5d | 165 | and the maximum transmission unit (``mtu'') are also displayed. |
b5dc1377 | 166 | .Pp |
93874d5d KM |
167 | The routing table display indicates the available routes and |
168 | their status. Each route consists of a destination host or network | |
169 | and a gateway to use in forwarding packets. The flags field shows | |
84efacbd | 170 | the state of the route (``U'' if ``up''), whether the route |
77560d37 MK |
171 | is to a gateway (``G''), whether the route was created dynamically |
172 | by a redirect (``D''), and whether the route has been modified | |
173 | by a redirect (``M''). Direct routes are created for each | |
84efacbd MK |
174 | interface attached to the local host; |
175 | the gateway field for such entries shows the address of the outgoing interface. | |
176 | The refcnt field gives the | |
93874d5d KM |
177 | current number of active uses of the route. Connection oriented |
178 | protocols normally hold on to a single route for the duration of | |
84efacbd MK |
179 | a connection while connectionless protocols obtain a route while sending |
180 | to the same destination. | |
181 | The use field provides a count of the number of packets | |
93874d5d KM |
182 | sent using that route. The interface entry indicates the network |
183 | interface utilized for the route. | |
b5dc1377 CL |
184 | .Pp |
185 | When | |
186 | .Nm netstat | |
c4f5a622 KB |
187 | is invoked with a |
188 | .Ar wait | |
189 | interval argument, it displays a running count of statistics related to | |
190 | network interfaces. | |
191 | This display consists of a column for the primary interface (the first | |
192 | interface found during autoconfiguration) and a column summarizing | |
84efacbd MK |
193 | information for all interfaces. |
194 | The primary interface may be replaced with another interface with the | |
b5dc1377 | 195 | .Fl I |
84efacbd MK |
196 | option. |
197 | The first line of each screen of information contains a summary since the | |
93874d5d KM |
198 | system was last rebooted. Subsequent lines of output show values |
199 | accumulated over the preceding interval. | |
b5dc1377 CL |
200 | .Sh SEE ALSO |
201 | .Xr iostat 1 , | |
c4f5a622 KB |
202 | .Xr nfsstat 1 , |
203 | .Xr ps 1 , | |
b5dc1377 CL |
204 | .Xr vmstat 1 , |
205 | .Xr hosts 5 , | |
206 | .Xr networks 5 , | |
207 | .Xr protocols 5 , | |
208 | .Xr services 5 , | |
c4f5a622 KB |
209 | .Xr trpt 8 , |
210 | .Xr trsp 8 | |
b5dc1377 | 211 | .Sh HISTORY |
263cc8fc CL |
212 | The |
213 | .Nm netstat | |
214 | command appeared in | |
215 | .Bx 4.2 . | |
c4f5a622 KB |
216 | .\" .Sh FILES |
217 | .\" .Bl -tag -width /dev/kmem -compact | |
218 | .\" .It Pa /vmunix | |
219 | .\" default kernel namelist | |
220 | .\" .It Pa /dev/kmem | |
221 | .\" default memory file | |
222 | .\" .El | |
b5dc1377 | 223 | .Sh BUGS |
c4f5a622 KB |
224 | The notion of errors is ill-defined. |
225 | .Pp | |
263cc8fc CL |
226 | Collisions mean something else for the |
227 | .Tn IMP . |