netstat - Display statistics related to networking. netstat(1) netstat(1) NAME netstat - show network status SYNOPSIS netstat [-aAn] [-f address-family] [system [core]] netstat [-mMnrsv] [-f address-family] [-p protocol] [system [core]] netstat [-gin] [-I interface] [interval] [system [core]] DESCRIPTION netstat displays statistics for network interfaces and protocols, as well as the contents of various network-related data structures. The output format varies according to the options selected. Some options are ignored when used in combination with other options. Generally, the netstat command takes one of the three forms shown above: - The first form of the command displays a list of active sockets for each protocol. - The second form displays the contents of one of the other network data structures according to the option selected. - The third form displays configuration information for each network interface. It also displays network traffic data on configured network interfaces, optionally updated at each interval, measured in seconds. Options are interpreted as follows: -a Show the state of all sockets, including passive sockets used by server processes. When netstat is used without any options (except -A and -n), only active sockets are shown. This option does not show the state of X.25 programmatic access sockets. The option is ignored if the -g, -i, -I, -m, -M, -p, -r, -s or interval option is specified. -A Show the address of the protocol control block associated with sockets. This option is used for debugging. It does not show the X.25 programmatic access control blocks. This option is ignored if the -g, -i, -I, -m, -M, -p, -r, -s or interval option is specified. -f address-family Show statistics or address control block for only the specified address-family. The following address families are recognized: inet for AF_INET, and unix for AF_UNIX. This option applies to the -a, -A and -s options. -g Show multicast information for network interfaces. Only the address family AF_INET is recognized by this option. This option may be combined with the -i option to display both kinds of information. The option is ignored if the -m, -M or -p option is specified. -i Show the state of network interfaces. Interfaces that are statically configured into a system, but not located at boot time, are not shown. This option is ignored if the -m, -M or -p option is specified. -I interface Show information about the specified interface only. This option applies to the -g and -i options. -m Show statistics recorded by network memory management routines. If this option is specified, all other options are ignored. -M Show the multicast routing tables. When -s is used with the -M option, netstat displays multicast routing statistics instead. This option is ignored if the -m or -p option is specified. -n Show network addresses as numbers. Normally, netstat interprets addresses and attempts to display them symbolically. This option applies to the -a, -A, -i, -r and -v options. -p protocol Show statistics for the specified protocol. The following protocols are recognized: tcp, udp, ip, icmp, igmp, arp, and probe. This option is ignored if the -m option is specified. -r Show the routing tables. When -v is used with the -r option, netstat also displays the network masks in the route entries. When -s is used with the -r option, netstat displays routing statistics instead. This option is ignored if the -g, -m, -M, -i, -I, -p or interval option is specified. -s Show statistics for all protocols. When this option is used with the -r option, netstat displays routing statistics instead. When this option is used with the -M option, netstat displays multicast routing statistics instead. This option is ignored if the -g, -i, -I, -m, -p or interval option is specified. -v Show additional routing information. When -v is used with the -r option, netstat also displays the network masks in the route entries. This option only applies to the -r option. The arguments system and core allow substitutes for the defaults, /stand/vmunix and /dev/kmem. If no options or only the -A or -n option is specified, netstat displays the status of only active sockets. The display of active and passive sockets status shows the local and remote addresses, send and receive queue sizes (in bytes), protocol, and the internal state of the protocol. Address formats are of the form host.port, or network.port if the host portion of a socket address is zero. When known, the host and network addresses are displayed symbolically by using gethostbyname() and getnetbyname(), respectively (see gethostbyname(3N) and getnetbyname(3N)). If a symbolic name for an address is unknown, or if the -n option is specified, the address is displayed numerically according to the address family. For more information regarding the Internet ``dot format'', refer to inet(3N). Unspecified or ``wildcard'' addresses and ports appear as an asterisk (*). The interface display provides a table of cumulative statistics regarding packets transferred, errors, and collisions. The network addresses of the interface and the maximum transmission unit (MTU) are also displayed. When the interval argument is specified, netstat displays a running count of statistics related to network interfaces. This display consists of a column for the primary interface (the first interface found during auto-configuration) and a column summarizing information for all interfaces. To replace the primary interface with another interface, use the -I option. The first line of each screen of information contains a summary since the system was last rebooted. Subsequent lines of output show values accumulated over the preceding interval. The routing table display indicates the available routes and their status. Each route consists of a destination host or network, a netmask and a gateway to use in forwarding packets. The Flags field shows whether the route is up (U), whether the route is to a gateway (G), whether the route is a host or network route (with or without H), whether the route was created dynamically (D) by a redirect or by Path MTU Discovery, and whether a gateway route has been modified (M), or it has been marked doubtful (?) due to the lack of a timely ARP response. The Netmask field shows the mask to be applied to the destination IP address of an IP packet to be forwarded. The result will be compared with the destination address in the route entry. If they are the same, then the route is one of the candidates for routing this IP packet. If there are several candidate routes, then the route with the longest Netmask field (contiguous 1's starting from the leftmost bit position) will be chosen. (see routing (7).) The Gateway field shows the address of the immediate gateway for reaching the destination. It can be the address of the outgoing interface if the destination is on a directly connected network. The Refs field shows the current number of active uses of the route. Connection-oriented protocols normally hold on to a single route for the duration of a connection, while connectionless protocols normally obtain a route just while sending a particular message. The Use field shows a count of the number of packets sent using the route. The Interface field identifies which network interface is used for the route. The Pmtu and PmtuTime fields apply only to host routes. The Pmtu field for network and default routes is the same as the MTU of the network interface used for the route. If the route is created with a static PMTU value (see route(1M)), the corresponding PmtuTime field contains the word perm, and the PMTU value permanently overrides the interface MTU. If the route is created dynamically (D in the Flags field), the value in the corresponding PmtuTime field is the number of minutes remaining before the PMTU expires. When the PMTU expires, the system rediscovers the current PMTU for the route, in case it has changed. The PmtuTime field is left blank when the PMTU is identical to the MTU of the interface. An asterisk (*) in the Pmtu field indicates that user has disabled the PMTU Discovery for the route. DEPENDENCIES X.25: -A and -a options do not list X.25 programmatic access information. AUTHOR netstat was developed by the University of California, Berkeley. SEE ALSO hosts(4), networks(4), gethostbyname(3N), getnetbyname(3N), protocols(4), route(1M), services(4). |