1 '\" te
   2 .\" Copyright (C) 2002, Sun Microsystems, Inc. All Rights Reserved
   3 .\" Copyright 1989 AT&T
   4 .\" Copyright (c) 1983 Regents of the University of California. All rights reserved. The Berkeley software License Agreement specifies the terms and conditions for redistribution.
   5 .TH NETSTAT 1M "Jul 12, 2016"
   6 .SH NAME
   7 netstat \- show network status
   8 .SH SYNOPSIS
   9 .LP
  10 .nf
  11 \fBnetstat\fR [\fB-anuvR\fR] [\fB-f\fR \fIaddress_family\fR] [\fB-P\fR \fIprotocol\fR]
  12 .fi
  13 
  14 .LP
  15 .nf
  16 \fBnetstat\fR \fB-g\fR [\fB-nv\fR] [\fB-f\fR \fIaddress_family\fR]
  17 .fi
  18 
  19 .LP
  20 .nf
  21 \fBnetstat\fR \fB-p\fR [\fB-n\fR] [\fB-f\fR \fIaddress_family\fR]
  22 .fi
  23 
  24 .LP
  25 .nf
  26 \fBnetstat\fR \fB-s\fR [\fB-f\fR \fIaddress_family\fR] [\fB-P\fR \fIprotocol\fR]
  27      [\fB-T\fR u | d ] [\fIinterval\fR [\fIcount\fR]]
  28 .fi
  29 
  30 .LP
  31 .nf
  32 \fBnetstat\fR \fB-m\fR [\fB-T\fR u | d ] [\fB-v\fR] [\fIinterval\fR [\fIcount\fR]]
  33 .fi
  34 
  35 .LP
  36 .nf
  37 \fBnetstat\fR \fB-i\fR [\fB-I\fR \fIinterface\fR] [\fB-an\fR] [\fB-f\fR \fIaddress_family\fR]
  38      [\fB-T\fR u | d ] [\fIinterval\fR [\fIcount\fR]]
  39 .fi
  40 
  41 .LP
  42 .nf
  43 \fBnetstat\fR \fB-r\fR [\fB-anvR\fR] [\fB-f\fR \fIaddress_family\fR | \fIfilter\fR]
  44 .fi
  45 
  46 .LP
  47 .nf
  48 \fBnetstat\fR \fB-M\fR [\fB-ns\fR] [\fB-f\fR \fIaddress_family\fR]
  49 .fi
  50 
  51 .LP
  52 .nf
  53 \fBnetstat\fR \fB-D\fR [\fB-I\fR \fIinterface\fR] [\fB-f\fR \fIaddress_family\fR]
  54 .fi
  55 
  56 .SH DESCRIPTION
  57 .LP
  58 The \fBnetstat\fR command displays the contents of certain network-related data
  59 structures in various formats, depending on the options you select.
  60 .LP
  61 The \fBnetstat\fR command has the several forms shown in the SYNOPSIS section,
  62 above, listed as follows:
  63 .RS +4
  64 .TP
  65 .ie t \(bu
  66 .el o
  67 The first form of the command (with no required arguments) displays a list of
  68 active sockets for each protocol.
  69 .RE
  70 .RS +4
  71 .TP
  72 .ie t \(bu
  73 .el o
  74 The second, third, and fourth forms (\fB-g\fR, \fB-p\fR, and \fB-s\fR options)
  75 display information from various network data structures.
  76 .RE
  77 .RS +4
  78 .TP
  79 .ie t \(bu
  80 .el o
  81 The fifth form (\fB-m\fR option) displays STREAMS memory statistics.
  82 .RE
  83 .RS +4
  84 .TP
  85 .ie t \(bu
  86 .el o
  87 The sixth form (\fB-i\fR option) shows the state of the interfaces.
  88 .RE
  89 .RS +4
  90 .TP
  91 .ie t \(bu
  92 .el o
  93 The seventh form (\fB-r\fR option) displays the routing table.
  94 .RE
  95 .RS +4
  96 .TP
  97 .ie t \(bu
  98 .el o
  99 The eighth form (\fB-M\fR option) displays the multicast routing table.
 100 .RE
 101 .RS +4
 102 .TP
 103 .ie t \(bu
 104 .el o
 105 The ninth form (\fB-D\fR option) displays the state of \fBDHCP\fR on one or all
 106 interfaces.
 107 .RE
 108 .LP
 109 These forms are described in greater detail below.
 110 .LP
 111 With no arguments (the first form), \fBnetstat\fR displays connected sockets
 112 for \fBPF_INET\fR, \fBPF_INET6\fR, and \fBPF_UNIX\fR, unless modified otherwise
 113 by the \fB-f\fR option.
 114 .SH OPTIONS
 115 .ne 2
 116 .na
 117 \fB\fB-a\fR\fR
 118 .ad
 119 .sp .6
 120 .RS 4n
 121 Show the state of all sockets, all routing table entries, or all interfaces,
 122 both physical and logical. Normally, listener sockets used by server processes
 123 are not shown. Under most conditions, only interface, host, network, and
 124 default routes are shown and only the status of physical interfaces is shown.
 125 .RE
 126 
 127 .sp
 128 .ne 2
 129 .na
 130 \fB\fB-f\fR \fIaddress_family\fR\fR
 131 .ad
 132 .sp .6
 133 .RS 4n
 134 Limit all displays to those of the specified \fIaddress_family\fR. The value of
 135 \fIaddress_family\fR can be one of the following:
 136 .sp
 137 .ne 2
 138 .na
 139 \fB\fBinet\fR\fR
 140 .ad
 141 .RS 9n
 142 For the \fBAF_INET\fR address family showing IPv4 information.
 143 .RE
 144 
 145 .sp
 146 .ne 2
 147 .na
 148 \fB\fBinet6\fR\fR
 149 .ad
 150 .RS 9n
 151 For the \fBAF_INET6\fR address family showing IPv6 information.
 152 .RE
 153 
 154 .sp
 155 .ne 2
 156 .na
 157 \fB\fBunix\fR\fR
 158 .ad
 159 .RS 9n
 160 For the \fBAF_UNIX\fR address family.
 161 .RE
 162 
 163 .RE
 164 
 165 .sp
 166 .ne 2
 167 .na
 168 \fB\fB-f\fR \fIfilter\fR\fR
 169 .ad
 170 .sp .6
 171 .RS 4n
 172 With \fB-r\fR only, limit the display of routes to those matching the specified
 173 filter. A filter rule consists of a \fIkeyword\fR:\fIvalue\fR pair. The known
 174 keywords and the value syntax are:
 175 .sp
 176 .ne 2
 177 .na
 178 \fB\fBaf:\fR{\fBinet\fR|\fBinet6\fR|\fBunix\fR|\fInumber\fR}\fR
 179 .ad
 180 .sp .6
 181 .RS 4n
 182 Selects an address family. This is identical to \fB-f\fR \fIaddress_family\fR
 183 and both syntaxes are supported.
 184 .RE
 185 
 186 .sp
 187 .ne 2
 188 .na
 189 \fB\fBoutif\fR:{\fIname\fR|\fIifIndex\fR|\fBany\fR|\fBnone\fR}\fR
 190 .ad
 191 .sp .6
 192 .RS 4n
 193 Selects an output interface. You can specify the interface by name (such as
 194 \fBhme0\fR) or by \fBifIndex\fR number (for example, \fB2\fR). If \fBany\fR is
 195 used, the filter matches all routes having a specified interface (anything
 196 other than null). If \fBnone\fR is used, the filter matches all routes having a
 197 null interface. Note that you can view the index number (\fIifIndex\fR) for an
 198 interface with the \fB-a\fR option of \fBifconfig\fR(1M).
 199 .RE
 200 
 201 .sp
 202 .ne 2
 203 .na
 204 \fB\fBdst\fR:{\fIip-address\fR[/\fImask\fR]|\fBany\fR|\fBnone\fR}\fR
 205 .ad
 206 .sp .6
 207 .RS 4n
 208 Selects a destination IP address. If specified with a mask length, then any
 209 routes with matching or longer (more specific) masks are selected. If \fBany\fR
 210 is used, then all but addresses but 0 are selected. If \fBnone\fR is used, then
 211 address 0 is selected.
 212 .RE
 213 
 214 .sp
 215 .ne 2
 216 .na
 217 \fB\fBflags:\fR[\fB+ -\fR]?[\fBABDGHLMSU\fR]\fB+\fR\fR
 218 .ad
 219 .sp .6
 220 .RS 4n
 221 Selects routes tagged with the specified flags. By default, the flags as
 222 specified must be set in order to match. With a leading \fB+\fR, the flags
 223 specified must be set but others are ignored. With a leading \fB-\fR, the flags
 224 specified must not be set and others are permitted.
 225 .RE
 226 
 227 You can specify multiple instances of \fB-f\fR to specify multiple filters. For
 228 example:
 229 .sp
 230 .in +2
 231 .nf
 232 % netstat -nr -f outif:hme0 -f outif:hme1 -f dst:10.0.0.0/8
 233 .fi
 234 .in -2
 235 .sp
 236 
 237 The preceding command displays routes within network 10.0.0.0/8, with mask
 238 length 8 or greater, and an output interface of either \fBhme0\fR or
 239 \fBhme1\fR, and excludes all other routes.
 240 .RE
 241 
 242 .sp
 243 .ne 2
 244 .na
 245 \fB\fB-g\fR\fR
 246 .ad
 247 .sp .6
 248 .RS 4n
 249 Show the multicast group memberships for all interfaces. If the \fB-v\fR option
 250 is included, source-specific membership information is also displayed. See
 251 DISPLAYS, below.
 252 .RE
 253 
 254 .sp
 255 .ne 2
 256 .na
 257 \fB\fB-i\fR\fR
 258 .ad
 259 .sp .6
 260 .RS 4n
 261 Show the state of the interfaces that are used for \fBIP\fR traffic. Normally
 262 this shows statistics for the physical interfaces. When combined with the
 263 \fB-a\fR option, this will also report information for the logical interfaces.
 264 See \fBifconfig\fR(1M).
 265 .RE
 266 
 267 .sp
 268 .ne 2
 269 .na
 270 \fB\fB-m\fR\fR
 271 .ad
 272 .sp .6
 273 .RS 4n
 274 Show the STREAMS memory statistics.
 275 .RE
 276 
 277 .sp
 278 .ne 2
 279 .na
 280 \fB\fB-n\fR\fR
 281 .ad
 282 .sp .6
 283 .RS 4n
 284 Show network addresses as numbers. \fBnetstat\fR normally displays addresses as
 285 symbols. This option may be used with any of the display formats.
 286 .RE
 287 
 288 .sp
 289 .ne 2
 290 .na
 291 \fB\fB-p\fR\fR
 292 .ad
 293 .sp .6
 294 .RS 4n
 295 Show the net to media tables. See DISPLAYS, below.
 296 .RE
 297 
 298 .sp
 299 .ne 2
 300 .na
 301 \fB\fB-r\fR\fR
 302 .ad
 303 .sp .6
 304 .RS 4n
 305 Show the routing tables. Normally, only interface, host, network, and default
 306 routes are shown, but when this option is combined with the \fB-a\fR option,
 307 all routes will be displayed, including cache. If you have not set up a
 308 multicast route, \fB-ra\fR might not show any multicast routing entries,
 309 although the kernel will derive such an entry if needed.
 310 .RE
 311 
 312 .sp
 313 .ne 2
 314 .na
 315 \fB\fB-s\fR\fR
 316 .ad
 317 .sp .6
 318 .RS 4n
 319 Show per-protocol statistics. When used with the \fB-M\fR option, show
 320 multicast routing statistics instead. When used with the \fB-a\fR option,
 321 per-interface statistics will be displayed, when available, in addition to
 322 statistics global to the system. See DISPLAYS, below.
 323 .RE
 324 
 325 .sp
 326 .ne 2
 327 .na
 328 \fB\fB-T\fR \fBu\fR | \fBd\fR\fR
 329 .ad
 330 .sp .6
 331 .RS 4n
 332 Display a time stamp.
 333 .sp
 334 Specify \fBu\fR for a printed representation of the internal representation of
 335 time. See \fBtime\fR(2). Specify \fBd\fR for standard date format. See
 336 \fBdate\fR(1).
 337 .RE
 338 
 339 .sp
 340 .ne 2
 341 .na
 342 \fB\fB-u\fR\fR
 343 .ad
 344 .sp .6
 345 .RS 4n
 346 When specified, for each network endpoint \fBnetstat\fR will print the list of
 347 the processes currently have an open file descriptor pointing to that endpoint.
 348 \fBnetstat\fR will list the username, process id, and the program for each
 349 process in that list.
 350 .RE
 351 
 352 .sp
 353 .ne 2
 354 .na
 355 \fB\fB-v\fR\fR
 356 .ad
 357 .sp .6
 358 .RS 4n
 359 Verbose. Show additional information for the sockets, STREAMS memory
 360 statistics, routing table, and multicast group memberships.
 361 .RE
 362 
 363 .sp
 364 .ne 2
 365 .na
 366 \fB\fB-I\fR \fIinterface\fR\fR
 367 .ad
 368 .sp .6
 369 .RS 4n
 370 Show the state of a particular interface. \fIinterface\fR can be any valid
 371 interface such as \fBhme0\fR or \fBeri0\fR. Normally, the status and statistics
 372 for physical interfaces are displayed. When this option is combined with the
 373 \fB-a\fR option, information for the logical interfaces is also reported.
 374 .RE
 375 
 376 .sp
 377 .ne 2
 378 .na
 379 \fB\fB-M\fR\fR
 380 .ad
 381 .sp .6
 382 .RS 4n
 383 Show the multicast routing tables. When used with the \fB-s\fR option, show
 384 multicast routing statistics instead.
 385 .RE
 386 
 387 .sp
 388 .ne 2
 389 .na
 390 \fB\fB-P\fR \fIprotocol\fR\fR
 391 .ad
 392 .sp .6
 393 .RS 4n
 394 Limit display of statistics or state of all sockets to those applicable to
 395 \fIprotocol\fR. The protocol can be one of \fBip\fR, \fBipv6\fR, \fBicmp\fR,
 396 \fBicmpv6\fR, \fBicmp\fR, \fBicmpv6\fR, \fBigmp\fR, \fBudp\fR, \fBtcp\fR,
 397 \fBrawip\fR. \fBrawip\fR can also be specified as \fBraw\fR. The command
 398 accepts protocol options only as all lowercase.
 399 .RE
 400 
 401 .sp
 402 .ne 2
 403 .na
 404 \fB\fB-D\fR\fR
 405 .ad
 406 .sp .6
 407 .RS 4n
 408 Show the status of \fBDHCP\fR configured interfaces.
 409 .RE
 410 
 411 .sp
 412 .ne 2
 413 .na
 414 \fB\fB-R\fR\fR
 415 .ad
 416 .sp .6
 417 .RS 4n
 418 This modifier displays extended security attributes for sockets and routing
 419 table entries. The \fB-R\fR modifier is available only if the system is
 420 configured with the Solaris Trusted Extensions feature.
 421 .sp
 422 With \fB-r\fR only, this option displays the routing entries' gateway security
 423 attributes. See \fBroute\fR(1M) for more information on security attributes.
 424 .sp
 425 When displaying socket information using the first form of the command, this
 426 option displays additional information for Multi-Level Port(MLP) sockets. This
 427 includes:
 428 .RS +4
 429 .TP
 430 .ie t \(bu
 431 .el o
 432 The label for the peer if the socket is connected.
 433 .RE
 434 .RS +4
 435 .TP
 436 .ie t \(bu
 437 .el o
 438 The following flags can be appended to the socket's "State" output:
 439 .RS
 440 
 441 .sp
 442 .ne 2
 443 .na
 444 \fB\fBP\fR\fR
 445 .ad
 446 .RS 5n
 447 The socket is a MLP on zone-private IP addresses.
 448 .RE
 449 
 450 .sp
 451 .ne 2
 452 .na
 453 \fB\fBS\fR\fR
 454 .ad
 455 .RS 5n
 456 The socket is a MLP on IP addresses shared between zones.
 457 .RE
 458 .SH OPERANDS
 459 .ne 2
 460 .na
 461 \fB\fIinterval\fR\fR
 462 .ad
 463 .RS 12n
 464 Display statistics accumulated since last display every \fIinterval\fR seconds,
 465 repeating forever, unless \fIcount\fR is specified. When invoked with
 466 \fIinterval\fR, the first row of netstat output shows statistics accumulated
 467 since last reboot.
 468 .sp
 469 The following options support \fIinterval\fR: \fB-i\fR, \fB-m\fR, \fB-s\fR and
 470 \fB-Ms\fR. Some values are configuration parameters and are just redisplayed at
 471 each interval.
 472 .RE
 473 
 474 .sp
 475 .ne 2
 476 .na
 477 \fB\fIcount\fR\fR
 478 .ad
 479 .RS 12n
 480 Display interface statistics the number of times specified by \fIcount\fR, at
 481 the interval specified by \fIinterval\fR.
 482 .RE
 483 
 484 .SH DISPLAYS
 485 .SS "Active Sockets (First Form)"
 486 .LP
 487 The display for each active socket shows the local and remote address, the send
 488 and receive queue sizes (in bytes), the send and receive windows (in bytes),
 489 and the internal state of the protocol.
 490 .LP
 491 The symbolic format normally used to display socket addresses is either:
 492 .sp
 493 .in +2
 494 .nf
 495 \fBhostname\fR.\fIport\fR
 496 .fi
 497 .in -2
 498 .sp
 499 when the name of the host is specified, or
 500 .sp
 501 .in +2
 502 .nf
 503 \fInetwork\fR.\fIport\fR
 504 .fi
 505 .in -2
 506 .sp
 507 if a socket address specifies a network but no specific host.
 508 .LP
 509 The numeric host address or network number associated with the socket is used
 510 to look up the corresponding symbolic hostname or network name in the
 511 \fIhosts\fR or \fInetworks\fR database.
 512 .LP
 513 If the network or hostname for an address is not known, or if the \fB-n\fR
 514 option is specified, the numerical network address is shown. Unspecified, or
 515 "wildcard", addresses and ports appear as an asterisk (\fB*\fR). For more
 516 information regarding the Internet naming conventions, refer to \fBinet\fR(7P)
 517 and \fBinet6\fR(7P).
 518 .LP
 519 For SCTP sockets, because an endpoint can be represented by multiple addresses,
 520 the verbose option (\fB-v\fR) displays the list of all the local and remote
 521 addresses.
 522 .SS "\fITCP Sockets\fR"
 523 .LP
 524 The possible state values for \fBTCP\fR sockets are as follows:
 525 .sp
 526 .ne 2
 527 .na
 528 \fB\fBBOUND\fR\fR
 529 .ad
 530 .RS 16n
 531 Bound, ready to connect or listen.
 532 .RE
 533 
 534 .sp
 535 .ne 2
 536 .na
 537 \fB\fBCLOSED\fR\fR
 538 .ad
 539 .RS 16n
 540 Closed. The socket is not being used.
 541 .RE
 542 
 543 .sp
 544 .ne 2
 545 .na
 546 \fB\fBCLOSING\fR\fR
 547 .ad
 548 .RS 16n
 549 Closed, then remote shutdown; awaiting acknowledgment.
 550 .RE
 551 
 552 .sp
 553 .ne 2
 554 .na
 555 \fB\fBCLOSE_WAIT\fR\fR
 556 .ad
 557 .RS 16n
 558 Remote shutdown; waiting for the socket to close.
 559 .RE
 560 
 561 .sp
 562 .ne 2
 563 .na
 564 \fB\fBESTABLISHED\fR\fR
 565 .ad
 566 .RS 16n
 567 Connection has been established.
 568 .RE
 569 
 570 .sp
 571 .ne 2
 572 .na
 573 \fB\fBFIN_WAIT_1\fR\fR
 574 .ad
 575 .RS 16n
 576 Socket closed; shutting down connection.
 577 .RE
 578 
 579 .sp
 580 .ne 2
 581 .na
 582 \fB\fBFIN_WAIT_2\fR\fR
 583 .ad
 584 .RS 16n
 585 Socket closed; waiting for shutdown from remote.
 586 .RE
 587 
 588 .sp
 589 .ne 2
 590 .na
 591 \fB\fBIDLE\fR\fR
 592 .ad
 593 .RS 16n
 594 Idle, opened but not bound.
 595 .RE
 596 
 597 .sp
 598 .ne 2
 599 .na
 600 \fB\fBLAST_ACK\fR\fR
 601 .ad
 602 .RS 16n
 603 Remote shutdown, then closed; awaiting acknowledgment.
 604 .RE
 605 
 606 .sp
 607 .ne 2
 608 .na
 609 \fB\fBLISTEN\fR\fR
 610 .ad
 611 .RS 16n
 612 Listening for incoming connections.
 613 .RE
 614 
 615 .sp
 616 .ne 2
 617 .na
 618 \fB\fBSYN_RECEIVED\fR\fR
 619 .ad
 620 .RS 16n
 621 Initial synchronization of the connection under way.
 622 .RE
 623 
 624 .sp
 625 .ne 2
 626 .na
 627 \fB\fBSYN_SENT\fR\fR
 628 .ad
 629 .RS 16n
 630 Actively trying to establish connection.
 631 .RE
 632 
 633 .sp
 634 .ne 2
 635 .na
 636 \fB\fBTIME_WAIT\fR\fR
 637 .ad
 638 .RS 16n
 639 Wait after close for remote shutdown retransmission.
 640 .RE
 641 
 642 .SS "\fISCTP Sockets\fR"
 643 .LP
 644 The possible state values for SCTP sockets are as follows:
 645 .sp
 646 .ne 2
 647 .na
 648 \fB\fBCLOSED\fR\fR
 649 .ad
 650 .RS 21n
 651 Closed. The socket is not being used.
 652 .RE
 653 
 654 .sp
 655 .ne 2
 656 .na
 657 \fB\fBLISTEN\fR\fR
 658 .ad
 659 .RS 21n
 660 Listening for incoming associations.
 661 .RE
 662 
 663 .sp
 664 .ne 2
 665 .na
 666 \fB\fBESTABLISHED\fR\fR
 667 .ad
 668 .RS 21n
 669 Association has been established.
 670 .RE
 671 
 672 .sp
 673 .ne 2
 674 .na
 675 \fB\fBCOOKIE_WAIT\fR\fR
 676 .ad
 677 .RS 21n
 678 \fBINIT\fR has been sent to the peer, awaiting acknowledgment.
 679 .RE
 680 
 681 .sp
 682 .ne 2
 683 .na
 684 \fB\fBCOOKIE_ECHOED\fR\fR
 685 .ad
 686 .RS 21n
 687 State cookie from the INIT-ACK has been sent to the peer, awaiting
 688 acknowledgement.
 689 .RE
 690 
 691 .sp
 692 .ne 2
 693 .na
 694 \fB\fBSHUTDOWN_PENDING\fR\fR
 695 .ad
 696 .RS 21n
 697 \fBSHUTDOWN\fR has been received from the upper layer, awaiting acknowledgement
 698 of all outstanding \fBDATA\fR from the peer.
 699 .RE
 700 
 701 .sp
 702 .ne 2
 703 .na
 704 \fB\fBSHUTDOWN_SENT\fR\fR
 705 .ad
 706 .RS 21n
 707 All outstanding data has been acknowledged in the \fBSHUTDOWN_SENT\fR state.
 708 \fBSHUTDOWN\fR has been sent to the peer, awaiting acknowledgement.
 709 .RE
 710 
 711 .sp
 712 .ne 2
 713 .na
 714 \fB\fBSHUTDOWN_RECEIVED\fR\fR
 715 .ad
 716 .RS 21n
 717 \fBSHUTDOWN\fR has been received from the peer, awaiting acknowledgement of all
 718 outstanding \fBDATA\fR.
 719 .RE
 720 
 721 .sp
 722 .ne 2
 723 .na
 724 \fB\fBSHUTDOWN_ACK_SENT\fR\fR
 725 .ad
 726 .RS 21n
 727 All outstanding data has been acknowledged in the \fBSHUTDOWN_RECEIVED\fR
 728 state. \fBSHUTDOWN_ACK\fR has been sent to the peer.
 729 .RE
 730 
 731 .SS "Network Data Structures (Second Through Fifth Forms)"
 732 .LP
 733 The form of the display depends upon which of the \fB-g\fR, \fB-m\fR, \fB-p\fR,
 734 or \fB-s\fR options you select.
 735 .sp
 736 .ne 2
 737 .na
 738 \fB\fB-g\fR\fR
 739 .ad
 740 .RS 6n
 741 Displays the list of multicast group membership.
 742 .RE
 743 
 744 .sp
 745 .ne 2
 746 .na
 747 \fB\fB-m\fR\fR
 748 .ad
 749 .RS 6n
 750 Displays the memory usage, for example, STREAMS mblks.
 751 .RE
 752 
 753 .sp
 754 .ne 2
 755 .na
 756 \fB\fB-p\fR\fR
 757 .ad
 758 .RS 6n
 759 Displays the net to media mapping table. For IPv4, the address resolution table
 760 is displayed. See \fBarp\fR(1M). For IPv6, the neighbor cache is displayed.
 761 .RE
 762 
 763 .sp
 764 .ne 2
 765 .na
 766 \fB\fB-s\fR\fR
 767 .ad
 768 .RS 6n
 769 Displays the statistics for the various protocol layers.
 770 .RE
 771 
 772 .sp
 773 .LP
 774 The statistics use the MIB specified variables. The defined values for
 775 \fBipForwarding\fR are:
 776 .sp
 777 .ne 2
 778 .na
 779 \fB\fBforwarding(1)\fR\fR
 780 .ad
 781 .RS 21n
 782 Acting as a gateway.
 783 .RE
 784 
 785 .sp
 786 .ne 2
 787 .na
 788 \fB\fBnot-forwarding(2)\fR\fR
 789 .ad
 790 .RS 21n
 791 Not acting as a gateway.
 792 .RE
 793 
 794 .sp
 795 .LP
 796 The IPv6 and ICMPv6 protocol layers maintain per-interface statistics. If the
 797 \fB-a\fR option is specified with the \fB-s\fR option, then the per-interface
 798 statistics as well as the total sums are displayed. Otherwise, just the sum of
 799 the statistics are shown.
 800 .LP
 801 For the second, third, and fourth forms of the command, you must specify at
 802 least \fB-g\fR, \fB-p\fR, or \fB-s\fR. You can specify any combination of these
 803 options. You can also specify \fB-m\fR (the fifth form) with any set of the
 804 \fB-g\fR, \fB-p\fR, and \fB-s\fR options. If you specify more than one of these
 805 options, \fBnetstat\fR displays the information for each one of them.
 806 .SS "Interface Status (Sixth Form)"
 807 .LP
 808 The interface status display lists information for all current interfaces, one
 809 interface per line. If an interface is specified using the \fB-I\fR option, it
 810 displays information for only the specified interface.
 811 .LP
 812 The list consists of the interface name, \fBmtu\fR (maximum transmission unit,
 813 or maximum packet size)(see \fBifconfig\fR(1M)), the network to which the
 814 interface is attached, addresses for each interface, and counter associated
 815 with the interface. The counters show the number of input packets, input
 816 errors, output packets, output errors, and collisions, respectively. For
 817 Point-to-Point interfaces, the Net/Dest field is the name or address on the
 818 other side of the link.
 819 .LP
 820 If the \fB-a\fR option is specified with either the \fB-i\fR option or the
 821 \fB-I\fR option, then the output includes names of the physical interface(s),
 822 counts for input packets and output packets for each logical interface, plus
 823 additional information.
 824 .LP
 825 If the \fB-n\fR option is specified, the list displays the IP address instead
 826 of the interface name.
 827 .LP
 828 If an optional \fIinterval\fR is specified, the output will be continually
 829 displayed in \fIinterval\fR seconds until interrupted by the user or until
 830 \fIcount\fR is reached. See OPERANDS.
 831 .LP
 832 The physical interface is specified using the \fB-I\fR option. When used with
 833 the \fIinterval\fR operand, output for the \fB-I\fR option has the following
 834 format:
 835 .sp
 836 .in +2
 837 .nf
 838 input    eri0          output        input          (Total)   output
 839 packets  errs  packets errs  colls   packets  errs  packets  errs   colls
 840 227681   0     659471  1     502     261331   0     99597    1      502
 841 10       0     0       0     0       10       0     0        0      0
 842 8        0     0       0     0       8        0     0        0      0
 843 10       0     2       0     0       10       0     2        0      0
 844 .fi
 845 .in -2
 846 .sp
 847 .LP
 848 If the input interface is not specified, the first interface of address family
 849 \fBinet\fR or \fBinet6\fR will be displayed.
 850 .SS "Routing Table (Seventh Form)"
 851 .LP
 852 The routing table display lists the available routes and the status of each.
 853 Each route consists of a destination host or network, and a gateway to use in
 854 forwarding packets. The \fIflags\fR column shows the status of the route. These
 855 flags are as follows:
 856 .sp
 857 .ne 2
 858 .na
 859 \fB\fBU\fR\fR
 860 .ad
 861 .RS 5n
 862 Indicates route is \fBup\fR.
 863 .RE
 864 
 865 .sp
 866 .ne 2
 867 .na
 868 \fB\fBG\fR\fR
 869 .ad
 870 .RS 5n
 871 Route is to a gateway.
 872 .RE
 873 
 874 .sp
 875 .ne 2
 876 .na
 877 \fB\fBH\fR\fR
 878 .ad
 879 .RS 5n
 880 Route is to a host and not a network.
 881 .RE
 882 
 883 .sp
 884 .ne 2
 885 .na
 886 \fB\fBM\fR\fR
 887 .ad
 888 .RS 5n
 889 Redundant route established with the \fB-multirt\fR option.
 890 .RE
 891 
 892 .sp
 893 .ne 2
 894 .na
 895 \fB\fBS\fR\fR
 896 .ad
 897 .RS 5n
 898 Route was established using the \fB-setsrc\fR option.
 899 .RE
 900 
 901 .sp
 902 .ne 2
 903 .na
 904 \fB\fBD\fR\fR
 905 .ad
 906 .RS 5n
 907 Route was created dynamically by a redirect.
 908 .RE
 909 
 910 .sp
 911 .LP
 912 If the \fB-a\fR option is specified, there will be routing entries with the
 913 following flags:
 914 .sp
 915 .ne 2
 916 .na
 917 \fB\fBA\fR\fR
 918 .ad
 919 .RS 5n
 920 Combined routing and address resolution entries.
 921 .RE
 922 
 923 .sp
 924 .ne 2
 925 .na
 926 \fB\fBB\fR\fR
 927 .ad
 928 .RS 5n
 929 Broadcast addresses.
 930 .RE
 931 
 932 .sp
 933 .ne 2
 934 .na
 935 \fB\fBL\fR\fR
 936 .ad
 937 .RS 5n
 938 Local addresses for the host.
 939 .RE
 940 
 941 .LP
 942 Interface routes are created for each interface attached to the local host; the
 943 gateway field for such entries shows the address of the outgoing interface.
 944 .LP
 945 The \fBuse\fR column displays the number of packets sent using a combined
 946 routing and address resolution (\fBA\fR) or a broadcast (\fBB\fR) route. For a
 947 local (\fBL\fR) route, this count is the number of packets received, and for
 948 all other routes it is the number of times the routing entry has been used to
 949 create a new combined route and address resolution entry.
 950 .LP
 951 The \fIinterface\fR entry indicates the network interface utilized for the
 952 route.
 953 .SS "Multicast Routing Tables (Eighth Form)"
 954 .LP
 955 The multicast routing table consists of the virtual interface table and the
 956 actual routing table.
 957 .SS "DHCP Interface Information (Ninth Form)"
 958 .LP
 959 The \fBDHCP\fR interface information consists of the interface name, its
 960 current state, lease information, packet counts, and a list of flags.
 961 .LP
 962 The states correlate with the specifications set forth in \fIRFC 2131\fR.
 963 .LP
 964 Lease information includes:
 965 .RS +4
 966 .TP
 967 .ie t \(bu
 968 .el o
 969 when the lease began;
 970 .RE
 971 .RS +4
 972 .TP
 973 .ie t \(bu
 974 .el o
 975 when lease renewal will begin; and
 976 .RE
 977 .RS +4
 978 .TP
 979 .ie t \(bu
 980 .el o
 981 when the lease will expire.
 982 .RE
 983 .sp
 984 .LP
 985 The flags currently defined include:
 986 .sp
 987 .ne 2
 988 .na
 989 \fB\fBBOOTP\fR\fR
 990 .ad
 991 .RS 11n
 992 The interface has a lease obtained through \fBBOOTP\fR (IPv4 only).
 993 .RE
 994 
 995 .sp
 996 .ne 2
 997 .na
 998 \fB\fBBUSY\fR\fR
 999 .ad
1000 .RS 11n
1001 The interface is busy with a \fBDHCP\fR transaction.
1002 .RE
1003 
1004 .sp
1005 .ne 2
1006 .na
1007 \fB\fBPRIMARY\fR\fR
1008 .ad
1009 .RS 11n
1010 The interface is the primary interface. See \fBdhcpinfo\fR(1) and
1011 \fBifconfig\fR(1M).
1012 .RE
1013 
1014 .sp
1015 .ne 2
1016 .na
1017 \fB\fBFAILED\fR\fR
1018 .ad
1019 .RS 11n
1020 The interface is in failure state and must be manually restarted.
1021 .RE
1022 
1023 .LP
1024 Packet counts are maintained for the number of packets sent, the number of
1025 packets received, and the number of lease offers declined by the \fBDHCP\fR
1026 client. All three counters are initialized to zero and then incremented while
1027 obtaining a lease. The counters are reset when the period of lease renewal
1028 begins for the interface. Thus, the counters represent either the number of
1029 packets sent, received, and declined while obtaining the current lease, or the
1030 number of packets sent, received, and declined while attempting to obtain a
1031 future lease.
1032 .SH FILES
1033 .ne 2
1034 .na
1035 \fB\fB/etc/default/inet_type\fR\fR
1036 .ad
1037 .RS 26n
1038 \fBDEFAULT_IP\fR setting
1039 .RE
1040 
1041 .SH SEE ALSO
1042 .LP
1043 \fBarp\fR(1M), \fBdhcpinfo\fR(1), \fBdhcpagent\fR(1M), \fBifconfig\fR(1M),
1044 \fBiostat\fR(1M), \fBkstat\fR(1M), \fBmibiisa\fR(1M), \fBndp\fR(1M), \fBsavecore\fR(1M),
1045 \fBvmstat\fR(1M), \fBhosts\fR(4), \fBinet_type\fR(4), \fBnetworks\fR(4),
1046 \fBprotocols\fR(4), \fBservices\fR(4), \fBattributes\fR(5), \fBdhcp\fR(5),
1047 \fBkstat\fR(7D), \fBinet\fR(7P), \fBinet6\fR(7P)
1048 .sp
1049 .LP
1050 Droms, R., \fIRFC 2131, Dynamic Host Configuration Protocol\fR, Network Working
1051 Group, March 1997.
1052 .sp
1053 .LP
1054 Droms, R. \fIRFC 3315, Dynamic Host Configuration Protocol for IPv6
1055 (DHCPv6)\fR. Cisco Systems. July 2003.
1056 .SH NOTES
1057 .LP
1058 When displaying interface information, \fBnetstat\fR honors the
1059 \fBDEFAULT_IP\fR setting in \fB/etc/default/inet_type\fR. If it is set to
1060 \fBIP_VERSION4\fR, then \fBnetstat\fR will omit information relating to IPv6
1061 interfaces, statistics, connections, routes and the like.
1062 .LP
1063 However, you can override the \fBDEFAULT_IP\fR setting in
1064 \fB/etc/default/inet_type\fR on the command-line. For example, if you have used
1065 the command-line to explicitly request IPv6 information by using the
1066 \fBinet6\fR address family or one of the IPv6 protocols, it will override the
1067 \fBDEFAULT_IP\fR setting.
1068 .LP
1069 If you need to examine network status information following a kernel crash, use
1070 the \fBmdb\fR(1) utility on the \fBsavecore\fR(1M) output.
1071 .LP
1072 The \fBnetstat\fR utility obtains TCP statistics from the system by opening
1073 \fB/dev/tcp\fR and issuing queries. Because of this, \fBnetstat\fR might
1074 display an extra, unused connection in \fBIDLE\fR state when reporting
1075 connection status.
1076 .LP
1077 Previous versions of \fBnetstat\fR had undocumented methods for reporting
1078 kernel statistics published using the \fBkstat\fR(7D) facility. This
1079 functionality has been removed. Use \fBkstat\fR(1M) instead.
1080 .LP
1081 \fBnetstat\fR restricts its output to information that is relevant to the zone
1082 in which \fBnetstat\fR runs. (This is true for both shared-IP and exclusive-IP
1083 zones.)