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