Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (4770 KB)
netstat(1M)NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OPERANDS | DISPLAYS | FILES | ATTRIBUTES | SEE ALSO | NOTES NAME
SYNOPSIS
netstat -g [-n] [-f address_family] netstat -p [-n] [-f address_family] netstat -s [-f address_family] [-P protocol] netstat -m [-v] netstat -i [-I interface] [-an] [-f address_family] [interval[count]] netstat -r [-anv] [-f address_family | filter] netstat -M [-ns] [-f address_family] netstat -D [-I interface] [-f address_family] DESCRIPTION
The netstat command displays the contents of certain network-related data structures in various formats, depending on the options you select. The netstat command has the several forms shown in the SYNOPSIS section, above, listed as follows: These forms are described in greater detail below. With no arguments (the first form), netstat displays connected sockets for PF_INET, PF_INET6, and PF_UNIX, unless modified otherwise by the -f option. OPTIONS
OPERANDS
DISPLAYS
Active Sockets (First Form)The display for each active socket shows the local and remote address, the send and receive queue sizes (in bytes), the send and receive windows (in bytes), and the internal state of the protocol. The symbolic format normally used to display socket addresses is either
when the name of the host is specified, or
if a socket address specifies a network but no specific host. The numeric host address or network number associated with the socket is used to look up the corresponding symbolic hostname or network name in the hosts or networks database. If the network or hostname for an address is not known, or if the -n option is specified, the numerical network address is shown. Unspecified, or "wildcard", addresses and ports appear as "*". For more information regarding the Internet naming conventions, refer to inet(7P) and inet6(7P). TCP SocketsThe possible state values for TCP sockets are as follows: Network Data Structures (Second Through Fifth Forms)The form of the display depends upon which of the -g, -m, -p, or -s options you select. The statistics use the MIB specified variables. The defined values for ipForwarding are: The IPv6 and ICMPv6 protocol layers maintain per-interface statistics. If the -a option is specified with the -s option, then the per-interface statistics as well as the total sums are displayed. Otherwise, just the sum of the statistics are shown. For the second, third, and fourth forms of the command, you must specify at least -g, -p, or -s. You can specify any combination of these options. You can also specify -m (the fifth form) with any set of the -g, -p, and -s options. If you specify more than one of these options, netstat displays the information for each one of them. Interface Status (Sixth Form)The interface status display lists information for all current interfaces, one interface per line. If an interface is specified using the -I option, it displays information for only the specified interface. The list consists of the interface name, mtu (maximum transmission unit, or maximum packet size)(see ifconfig(1M)), the network to which the interface is attached, addresses for each interface, and counter associated with the interface. The counters show the number of input packets, input errors, output packets, output errors, and collisions, respectively. For Point-to-Point interfaces, the Net/Dest field is the name or address on the other side of the link. If the -a option is specified with either the -i option or the -I option, then the output includes names of the physical interface(s), counts for input packets and output packets for each logical interface, plus additional information. If the -n option is specified, the list displays the IP address instead of the interface name. If an optional interval is specified, the output will be continually displayed in interval seconds until interrupted by the user or until count is reached. See OPERANDS. The physical interface is specified using the -I option. When used with the interval operand, output for the -I option has the following format:
If the input interface is not specified, the first interface of address family inet or inet6 will be displayed. Routing Table (Seventh Form)The routing table display lists the available routes and the status of each. Each route consists of a destination host or network, and a gateway to use in forwarding packets. The flags column shows the status of the route (U if "up"), whether the route is to a gateway (G), and whether the route was created dynamically by a redirect (D). If the -a option is specified, there will be routing entries with flags for combined routing and address resolution entries (A), broadcast addresses (B), and the local addresses for the host (L). Interface routes are created for each interface attached to the local host; the gateway field for such entries shows the address of the outgoing interface. The use column displays the number of packets sent using a combined routing and address resolution (A) or a broadcast (B) route. For a local (L) route, this count is the number of packets received, and for all other routes it is the number of times the routing entry has been used to create a new combined route and address resolution entry. The interface entry indicates the network interface utilized for the route. Multicast Routing Tables (Eighth Form)DHCP Interface Information (Ninth Form)The DHCP interface information consists of the interface name, its current state, lease information, packet counts, and a list of flags. The states correlate with the specifications set forth in RFC 2131. The flags currently defined include: FILESATTRIBUTESSee attributes(5) for descriptions of the following attributes:
SEE ALSOarp(1M), dhcpinfo(1), dhcpagent(1M), ifconfig(1M), iostat(1M), mibiisa(1M), savecore(1M), vmstat(1M), hosts(4), inet_type(4), networks(4), protocols(4), services(4), attributes(5), inet(7P), inet6(7P) Droms, R., RFC 2131, Dynamic Host Configuration Protocol, Network Working Group, March 1997. NOTESWhen displaying interface information, netstat honors the DEFAULT_IP setting in /etc/default/inet_type. If it is set to IP_VERSION4, then netstat will omit information relating to IPv6 interfaces, statistics, connections, routes and the like. However, you can override the DEFAULT_IP setting in /etc/default/inet_type on the command-line. For example, if you have used the command-line to explicitly request IPv6 information by using the inet6 address family or one of the IPv6 protocols, it will override the DEFAULT_IP setting. If you need to examine network status information following a kernel crash, use the mdb(1) utility on the savecore(1M) output. NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OPERANDS | DISPLAYS | FILES | ATTRIBUTES | SEE ALSO | NOTES |
||||||||