| 1 |
.\" |
| 2 |
.\" netstat.8 |
| 3 |
.\" |
| 4 |
.\" Original: ([email protected] & [email protected]) |
| 5 |
.\" |
| 6 |
.\" Modified: [email protected] |
| 7 |
.\" Modified: Andi Kleen [email protected] |
| 8 |
.\" Modified: Tuan Hoang [email protected] |
| 9 |
.\" Modified: Brian Micek [email protected] |
| 10 |
.\" |
| 11 |
.\" |
| 12 |
.TH NETSTAT 8 "2014\-10\-07" "net\-tools" "Linux System Administrator's Manual" |
| 13 |
|
| 14 |
.SH NAME |
| 15 |
netstat \- Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships |
| 16 |
|
| 17 |
.SH SYNOPSIS |
| 18 |
|
| 19 |
.B netstat |
| 20 |
.RI [ address_family_options ] |
| 21 |
.RB [ \-\-tcp | \-t ] |
| 22 |
.RB [ \-\-udp | \-u ] |
| 23 |
.RB [ \-\-udplite | \-U ] |
| 24 |
.RB [ \-\-sctp | \-S ] |
| 25 |
.RB [ \-\-raw | \-w ] |
| 26 |
.RB [ \-\-l2cap | \-2 ] |
| 27 |
.RB [ \-\-rfcomm | \-f ] |
| 28 |
.RB [ \-\-listening | \-l ] |
| 29 |
.RB [ \-\-all | \-a ] |
| 30 |
.RB [ \-\-numeric | \-n ] |
| 31 |
.RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ] |
| 32 |
.RB [ \-\-symbolic | \-N ] |
| 33 |
.RB [ \-\-extend | \-e [ \-\-extend | \-e] ] |
| 34 |
.RB [ \-\-timers | \-o ] |
| 35 |
.RB [ \-\-program | \-p ] |
| 36 |
.RB [ \-\-verbose | \-v ] |
| 37 |
.RB [ \-\-continuous | \-c] |
| 38 |
.RB [ \-\-wide | \-W ] |
| 39 |
.P |
| 40 |
.B netstat |
| 41 |
.RB { \-\-route | \-r } |
| 42 |
.RI [ address_family_options ] |
| 43 |
.RB [ \-\-extend | \-e [ \-\-extend | \-e] ] |
| 44 |
.RB [ \-\-verbose | \-v ] |
| 45 |
.RB [ \-\-numeric | \-n ] |
| 46 |
.RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ] |
| 47 |
.RB [ \-\-continuous | \-c ] |
| 48 |
.P |
| 49 |
.B netstat |
| 50 |
.RB { \-\-interfaces | \-i } |
| 51 |
.RB [ \-\-all | \-a ] |
| 52 |
.RB [ \-\-extend | \-e [ \-\-extend | \-e] ] |
| 53 |
.RB [ \-\-verbose | \-v ] |
| 54 |
.RB [ \-\-program | \-p ] |
| 55 |
.RB [ \-\-numeric | \-n ] |
| 56 |
.RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ] |
| 57 |
.RB [ \-\-continuous | \-c ] |
| 58 |
.P |
| 59 |
.B netstat |
| 60 |
.RB { \-\-groups | \-g } |
| 61 |
.RB [ \-\-numeric | \-n ] |
| 62 |
.RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ] |
| 63 |
.RB [ \-\-continuous | \-c ] |
| 64 |
.P |
| 65 |
.B netstat |
| 66 |
.RB { \-\-masquerade | \-M } |
| 67 |
.RB [ \-\-extend | \-e ] |
| 68 |
.RB [ \-\-numeric | \-n ] |
| 69 |
.RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ] |
| 70 |
.RB [ \-\-continuous | \-c ] |
| 71 |
.P |
| 72 |
.B netstat |
| 73 |
.RB { \-\-statistics | -s } |
| 74 |
.RB [ \-\-tcp | \-t ] |
| 75 |
.RB [ \-\-udp | \-u ] |
| 76 |
.RB [ \-\-udplite | \-U ] |
| 77 |
.RB [ \-\-sctp | \-S ] |
| 78 |
.RB [ \-\-raw | \-w ] |
| 79 |
.P |
| 80 |
.B netstat |
| 81 |
.RB { \-\-version | \-V } |
| 82 |
.P |
| 83 |
.B netstat |
| 84 |
.RB { \-\-help | \-h } |
| 85 |
.P |
| 86 |
.IR address_family_options : |
| 87 |
.PP |
| 88 |
.RB [ -4 | \-\-inet ] |
| 89 |
.RB [ -6 | \-\-inet6 ] |
| 90 |
.RB [ \-\-protocol= { inet , inet6 , unix , ipx , ax25 , netrom , ddp , bluetooth ", ... } ]" |
| 91 |
.RB [ \-\-unix | \-x ] |
| 92 |
.RB [ \-\-inet | \-\-ip | \-\-tcpip ] |
| 93 |
.RB [ \-\-ax25 ] |
| 94 |
.RB [ \-\-x25 ] |
| 95 |
.RB [ \-\-rose ] |
| 96 |
.RB [ \-\-ash ] |
| 97 |
.RB [ \-\-bluetooth ] |
| 98 |
.RB [ \-\-ipx ] |
| 99 |
.RB [ \-\-netrom ] |
| 100 |
.RB [ \-\-ddp | \-\-appletalk ] |
| 101 |
.RB [ \-\-econet | \-\-ec ] |
| 102 |
|
| 103 |
.SH NOTES |
| 104 |
This program is mostly obsolete. |
| 105 |
Replacement for \fBnetstat\fR is \fBss\fR. |
| 106 |
Replacement for \fBnetstat -r\fR is \fBip route\fR. |
| 107 |
Replacement for \fBnetstat -i\fR is \fBip -s link\fR. |
| 108 |
Replacement for \fBnetstat -g\fR is \fBip maddr\fR. |
| 109 |
|
| 110 |
.SH DESCRIPTION |
| 111 |
.B Netstat |
| 112 |
prints information about the Linux networking subsystem. The type of |
| 113 |
information printed is controlled by the first argument, as follows: |
| 114 |
.SS (none) |
| 115 |
By default, |
| 116 |
.B |
| 117 |
netstat |
| 118 |
displays a list of open sockets. If you don't specify any |
| 119 |
address families, then the active sockets of all configured address |
| 120 |
families will be printed. |
| 121 |
.SS "\-\-route, \-r" |
| 122 |
Display the kernel routing tables. See the description in |
| 123 |
.BR route (8) |
| 124 |
for details. |
| 125 |
.B netstat -r |
| 126 |
and |
| 127 |
.B route -e |
| 128 |
produce the same output. |
| 129 |
.SS "\-\-groups, \-g" |
| 130 |
Display multicast group membership information for IPv4 and IPv6. |
| 131 |
.SS "\-\-interfaces, \-i" |
| 132 |
Display a table of all network interfaces. |
| 133 |
.SS "\-\-masquerade, \-M" |
| 134 |
Display a list of masqueraded connections. |
| 135 |
.SS "\-\-statistics, \-s" |
| 136 |
Display summary statistics for each protocol. |
| 137 |
.SH OPTIONS |
| 138 |
.SS "\-\-verbose, \-v" |
| 139 |
Tell the user what is going on by being verbose. Especially print some |
| 140 |
useful information about unconfigured address families. |
| 141 |
.SS "\-\-wide, \-W" |
| 142 |
Do not truncate IP addresses by using output as wide as needed. This is |
| 143 |
optional for now to not break existing scripts. |
| 144 |
.SS "\-\-numeric, \-n" |
| 145 |
Show numerical addresses instead of trying to determine symbolic host, port |
| 146 |
or user names. |
| 147 |
.SS "\-\-numeric\-hosts" |
| 148 |
shows numerical host addresses but does not affect the resolution of |
| 149 |
port or user names. |
| 150 |
.SS "\-\-numeric\-ports" |
| 151 |
shows numerical port numbers but does not affect the resolution of |
| 152 |
host or user names. |
| 153 |
.SS "\-\-numeric\-users" |
| 154 |
shows numerical user IDs but does not affect the resolution of host or |
| 155 |
port names. |
| 156 |
|
| 157 |
.SS "\-\-protocol=\fIfamily\fR, \fB\-A" |
| 158 |
Specifies the address families (perhaps better described as low level |
| 159 |
protocols) for which connections are to be shown. |
| 160 |
.I family |
| 161 |
is a comma (',') separated list of address family keywords like |
| 162 |
.BR inet , |
| 163 |
.BR inet6 , |
| 164 |
.BR unix , |
| 165 |
.BR ipx , |
| 166 |
.BR ax25 , |
| 167 |
.BR netrom , |
| 168 |
.BR econet , |
| 169 |
.BR ddp , |
| 170 |
and |
| 171 |
.BR bluetooth . |
| 172 |
This has the same effect as using the |
| 173 |
.BR \-\-inet | -4 , |
| 174 |
.BR \-\-inet6 | -6 , |
| 175 |
.BR \-\-unix | -x , |
| 176 |
.BR \-\-ipx , |
| 177 |
.BR \-\-ax25 , |
| 178 |
.BR \-\-netrom , |
| 179 |
.BR \-\-ddp , |
| 180 |
and |
| 181 |
.B \-\-bluetooth |
| 182 |
options. |
| 183 |
.P |
| 184 |
The address family |
| 185 |
.B inet |
| 186 |
(Iv4) includes raw, udp, udplite and tcp protocol sockets. |
| 187 |
.P |
| 188 |
The address family |
| 189 |
.B bluetooth |
| 190 |
(Iv4) includes l2cap and rfcomm protocol sockets. |
| 191 |
.SS "\-c, \-\-continuous" |
| 192 |
This will cause |
| 193 |
.B netstat |
| 194 |
to print the selected information every second continuously. |
| 195 |
.SS "\-e, \-\-extend" |
| 196 |
Display additional information. Use this option twice for maximum detail. |
| 197 |
.SS "\-o, \-\-timers" |
| 198 |
Include information related to networking timers. |
| 199 |
.SS "\-p, \-\-program" |
| 200 |
Show the PID and name of the program to which each socket belongs. |
| 201 |
A hyphen is shown if the socket belongs to the kernel (e.g. a kernel service, |
| 202 |
or the process has exited but the socket hasn't finished closing yet). |
| 203 |
.SS "\-l, \-\-listening" |
| 204 |
Show only listening sockets. (These are omitted by default.) |
| 205 |
.SS "\-a, \-\-all" |
| 206 |
Show both listening and non-listening sockets. With the |
| 207 |
.B \-\-interfaces |
| 208 |
option, show interfaces that are not up |
| 209 |
.SS "\-F" |
| 210 |
Print routing information from the FIB. (This is the default.) |
| 211 |
.SS "\-C" |
| 212 |
Print routing information from the route cache. |
| 213 |
.P |
| 214 |
.SH OUTPUT |
| 215 |
.P |
| 216 |
.SS Active Internet connections \fR(TCP, UDP, UDPLite, raw)\fR |
| 217 |
.SS "Proto" |
| 218 |
The protocol (tcp, udp, udpl, raw) used by the socket. |
| 219 |
.SS "Recv\-Q" |
| 220 |
Established: The count of bytes not copied by the user program connected to this socket. |
| 221 |
Listening: Since Kernel 2.6.18 this column contains the current syn backlog. |
| 222 |
.SS "Send\-Q" |
| 223 |
Established: The count of bytes not acknowledged by the remote host. |
| 224 |
Listening: Since Kernel 2.6.18 this column contains the maximum size of the syn backlog. |
| 225 |
.SS "Local Address" |
| 226 |
Address and port number of the local end of the socket. Unless the |
| 227 |
.BR \-\-numeric " (" \-n ) |
| 228 |
option is specified, the socket address is resolved to its canonical |
| 229 |
host name (FQDN), and the port number is translated into the |
| 230 |
corresponding service name. |
| 231 |
.SS "Foreign Address" |
| 232 |
Address and port number of the remote end of the socket. |
| 233 |
Analogous to "Local Address". |
| 234 |
.SS "State" |
| 235 |
The state of the socket. Since there are no states in raw mode and usually no |
| 236 |
states used in UDP and UDPLite, this column may be left blank. Normally this can be one |
| 237 |
of several values: |
| 238 |
.TP |
| 239 |
.I |
| 240 |
ESTABLISHED |
| 241 |
The socket has an established connection. |
| 242 |
.TP |
| 243 |
.I |
| 244 |
SYN_SENT |
| 245 |
The socket is actively attempting to establish a connection. |
| 246 |
.TP |
| 247 |
.I |
| 248 |
SYN_RECV |
| 249 |
A connection request has been received from the network. |
| 250 |
.TP |
| 251 |
.I |
| 252 |
FIN_WAIT1 |
| 253 |
The socket is closed, and the connection is shutting down. |
| 254 |
.TP |
| 255 |
.I |
| 256 |
FIN_WAIT2 |
| 257 |
Connection is closed, and the socket is waiting for a shutdown from the |
| 258 |
remote end. |
| 259 |
.TP |
| 260 |
.I |
| 261 |
TIME_WAIT |
| 262 |
The socket is waiting after close to handle packets still in the network. |
| 263 |
.TP |
| 264 |
.I |
| 265 |
CLOSE |
| 266 |
The socket is not being used. |
| 267 |
.TP |
| 268 |
.I |
| 269 |
CLOSE_WAIT |
| 270 |
The remote end has shut down, waiting for the socket to close. |
| 271 |
.TP |
| 272 |
.I |
| 273 |
LAST_ACK |
| 274 |
The remote end has shut down, and the socket is closed. Waiting for |
| 275 |
acknowledgement. |
| 276 |
.TP |
| 277 |
.I |
| 278 |
LISTEN |
| 279 |
The socket is listening for incoming connections. Such sockets are |
| 280 |
not included in the output unless you specify the |
| 281 |
.BR \-\-listening " (" \-l ) |
| 282 |
or |
| 283 |
.BR \-\-all " (" \-a ) |
| 284 |
option. |
| 285 |
.TP |
| 286 |
.I |
| 287 |
CLOSING |
| 288 |
Both sockets are shut down but we still don't have all our data |
| 289 |
sent. |
| 290 |
.TP |
| 291 |
.I |
| 292 |
UNKNOWN |
| 293 |
The state of the socket is unknown. |
| 294 |
.SS "User" |
| 295 |
The username or the user id (UID) of the owner of the socket. |
| 296 |
.SS "PID/Program name" |
| 297 |
Slash-separated pair of the process id (PID) and process name of the |
| 298 |
process that owns the socket. |
| 299 |
.B \-\-program |
| 300 |
causes this column to be included. You will also need |
| 301 |
.I superuser |
| 302 |
privileges to see this information on sockets you don't own. This |
| 303 |
identification information is not yet available for IPX sockets. |
| 304 |
.SS "Timer" |
| 305 |
TCP timer associated with this socket. The format is timer(a/b/c). |
| 306 |
The timer is one of the following values: |
| 307 |
.TP |
| 308 |
.I |
| 309 |
off |
| 310 |
There is no timer set for this socket. |
| 311 |
.TP |
| 312 |
.I |
| 313 |
on |
| 314 |
The retransmission timer is active for the socket. |
| 315 |
.TP |
| 316 |
.I |
| 317 |
keepalive |
| 318 |
The keepalive timer is active for the socket. |
| 319 |
.TP |
| 320 |
.I |
| 321 |
timewait |
| 322 |
The connection is closing and the timewait timer is active for the socket. |
| 323 |
.P |
| 324 |
The values in the brackets: |
| 325 |
.TP |
| 326 |
.I |
| 327 |
a |
| 328 |
Timer value. |
| 329 |
.TP |
| 330 |
.I |
| 331 |
b |
| 332 |
Number of retransmissions sent. |
| 333 |
.TP |
| 334 |
.I |
| 335 |
c |
| 336 |
Number of keepalives sent. |
| 337 |
.P |
| 338 |
.SS Active UNIX domain Sockets |
| 339 |
.SS "Proto" |
| 340 |
The protocol (usually unix) used by the socket. |
| 341 |
.SS "RefCnt" |
| 342 |
The reference count (i.e. attached processes via this socket). |
| 343 |
.SS "Flags" |
| 344 |
The flags displayed is SO_ACCEPTON (displayed as |
| 345 |
.BR ACC ), |
| 346 |
SO_WAITDATA |
| 347 |
.RB ( W ) |
| 348 |
or SO_NOSPACE |
| 349 |
.RB ( N ). |
| 350 |
SO_ACCECPTON |
| 351 |
is used on unconnected sockets if their corresponding |
| 352 |
processes are waiting for a connect request. The other flags are not |
| 353 |
of normal interest. |
| 354 |
.SS "Type" |
| 355 |
There are several types of socket access: |
| 356 |
.TP |
| 357 |
.I |
| 358 |
SOCK_DGRAM |
| 359 |
The socket is used in Datagram (connectionless) mode. |
| 360 |
.TP |
| 361 |
.I |
| 362 |
SOCK_STREAM |
| 363 |
This is a stream (connection) socket. |
| 364 |
.TP |
| 365 |
.I |
| 366 |
SOCK_RAW |
| 367 |
The socket is used as a raw socket. |
| 368 |
.TP |
| 369 |
.I |
| 370 |
SOCK_RDM |
| 371 |
This one serves reliably-delivered messages. |
| 372 |
.TP |
| 373 |
.I |
| 374 |
SOCK_SEQPACKET |
| 375 |
This is a sequential packet socket. |
| 376 |
.TP |
| 377 |
.I |
| 378 |
SOCK_PACKET |
| 379 |
Raw interface access socket. |
| 380 |
.TP |
| 381 |
.I |
| 382 |
UNKNOWN |
| 383 |
Who ever knows what the future will bring us - just fill in here :-) |
| 384 |
.PP |
| 385 |
.SS "State" |
| 386 |
This field will contain one of the following Keywords: |
| 387 |
.TP |
| 388 |
.I FREE |
| 389 |
The socket is not allocated |
| 390 |
.TP |
| 391 |
.I LISTENING |
| 392 |
The socket is listening for a connection request. Such |
| 393 |
sockets are only included in the output if you specify the |
| 394 |
.BR \-\-listening " (" \-l ) |
| 395 |
or |
| 396 |
.BR \-\-all " (" \-a ) |
| 397 |
option. |
| 398 |
.TP |
| 399 |
.I CONNECTING |
| 400 |
The socket is about to establish a connection. |
| 401 |
.TP |
| 402 |
.I CONNECTED |
| 403 |
The socket is connected. |
| 404 |
.TP |
| 405 |
.I DISCONNECTING |
| 406 |
The socket is disconnecting. |
| 407 |
.TP |
| 408 |
.I (empty) |
| 409 |
The socket is not connected to another one. |
| 410 |
.TP |
| 411 |
.I UNKNOWN |
| 412 |
This state should never happen. |
| 413 |
.SS "PID/Program name" |
| 414 |
Process ID (PID) and process name of the process that has the socket open. |
| 415 |
More info available in |
| 416 |
.B "Active Internet connections" |
| 417 |
section written above. |
| 418 |
.SS "Path" |
| 419 |
This is the path name as which the corresponding processes attached |
| 420 |
to the socket. |
| 421 |
.P |
| 422 |
.SS Active IPX sockets |
| 423 |
(this needs to be done by somebody who knows it) |
| 424 |
.P |
| 425 |
.SS Active NET/ROM sockets |
| 426 |
(this needs to be done by somebody who knows it) |
| 427 |
.P |
| 428 |
.SS Active AX.25 sockets |
| 429 |
(this needs to be done by somebody who knows it) |
| 430 |
.PP |
| 431 |
|
| 432 |
.SH FILES |
| 433 |
.ta |
| 434 |
.I /etc/services |
| 435 |
-- The services translation file |
| 436 |
|
| 437 |
.I /proc |
| 438 |
-- Mount point for the proc filesystem, which gives access to kernel |
| 439 |
status information via the following files. |
| 440 |
|
| 441 |
.I /proc/net/dev |
| 442 |
-- device information |
| 443 |
|
| 444 |
.I /proc/net/raw |
| 445 |
-- raw socket information |
| 446 |
|
| 447 |
.I /proc/net/tcp |
| 448 |
-- TCP socket information |
| 449 |
|
| 450 |
.I /proc/net/udp |
| 451 |
-- UDP socket information |
| 452 |
|
| 453 |
.I /proc/net/udplite |
| 454 |
-- UDPLite socket information |
| 455 |
|
| 456 |
.I /proc/net/igmp |
| 457 |
-- IGMP multicast information |
| 458 |
|
| 459 |
.I /proc/net/unix |
| 460 |
-- Unix domain socket information |
| 461 |
|
| 462 |
.I /proc/net/ipx |
| 463 |
-- IPX socket information |
| 464 |
|
| 465 |
.I /proc/net/ax25 |
| 466 |
-- AX25 socket information |
| 467 |
|
| 468 |
.I /proc/net/appletalk |
| 469 |
-- DDP (appletalk) socket information |
| 470 |
|
| 471 |
.I /proc/net/nr |
| 472 |
-- NET/ROM socket information |
| 473 |
|
| 474 |
.I /proc/net/route |
| 475 |
-- IP routing information |
| 476 |
|
| 477 |
.I /proc/net/ax25_route |
| 478 |
-- AX25 routing information |
| 479 |
|
| 480 |
.I /proc/net/ipx_route |
| 481 |
-- IPX routing information |
| 482 |
|
| 483 |
.I /proc/net/nr_nodes |
| 484 |
-- NET/ROM nodelist |
| 485 |
|
| 486 |
.I /proc/net/nr_neigh |
| 487 |
-- NET/ROM neighbours |
| 488 |
|
| 489 |
.I /proc/net/ip_masquerade |
| 490 |
-- masqueraded connections |
| 491 |
|
| 492 |
.I /sys/kernel/debug/bluetooth/l2cap |
| 493 |
-- Bluetooth L2CAP information |
| 494 |
|
| 495 |
.I /sys/kernel/debug/bluetooth/rfcomm |
| 496 |
-- Bluetooth serial connections |
| 497 |
|
| 498 |
.I /proc/net/snmp |
| 499 |
-- statistics |
| 500 |
.fi |
| 501 |
.P |
| 502 |
.SH SEE ALSO |
| 503 |
.BR route (8), |
| 504 |
.BR ifconfig (8), |
| 505 |
.BR iptables (8), |
| 506 |
.BR proc (5), |
| 507 |
.BR ss (8), |
| 508 |
.BR ip (8) |
| 509 |
.P |
| 510 |
.SH BUGS |
| 511 |
Occasionally strange information may appear if a socket changes |
| 512 |
as it is viewed. This is unlikely to occur. |
| 513 |
.P |
| 514 |
.SH AUTHORS |
| 515 |
The netstat user interface was written by Fred Baumgarten |
| 516 |
<[email protected]\-karlsruhe.de>, the man page basically |
| 517 |
by Matt Welsh <[email protected]>. It was updated by |
| 518 |
Alan Cox <[email protected]>, updated again by Tuan Hoang |
| 519 |
<[email protected]>. The man page and the command included |
| 520 |
in the net\-tools package is totally rewritten by Bernd Eckenfels |
| 521 |
<[email protected]>. UDPLite options were added by Brian Micek |
| 522 |
<[email protected]> |