netstat - Displays network statistics.
netstat [-Arn|[-Aan][-f address_family][-p protocol]] [interval]
netstat [-adHimMnrstuv] [-f address_family] [-p protocol] [interval]
netstat [-ntdz] [-I interface [-c | -s]] [interval]
command displays network-related
data in various formats.
Displays the state of sockets related to the Internet protocol. Includes sockets for processes such as servers that are currently listening at a socket but are otherwise inactive. Displays either the address of any protocol control blocks associated with sockets or the addresses of routing table entries with bitmasks. Typically, this option is used for debugging. Displays the number of dropped packets; for use with the -I interface or -i options. You can also specify an interval argument (in seconds). Limits reports to the specified address family. The address families that can be specified might include the following: Specifies reports of the AF_INET family, if present in the kernel. Specifies reports of the AF_UNIX family, if present in the kernel. Lists information about all address families in the system. Lists information about any address families in the system. Displays the current ARP table (behaves like arp -a). Displays the state of configured interfaces. (Interfaces that are statically configured into the system, but not located at system startup, are not shown.)
argument specifies in seconds the interval for updating
and displaying information. The first line of the display shows cumulative
statistics; subsequent lines show statistics recorded during
When used without options, the netstat command displays a list of active sockets for each protocol. The default display shows the following items: Local and remote addresses Send and receive queue sizes (in bytes) Protocol State
Address formats are of the form
if a socket's address specifies
a network but no specific host address. The host and network address are
displayed symbolically unless
The network interface display format provides a table of cumulative statistics for the following: Interface name Maximum Transmission Unit (MTU) Network Address Packets received (Ipkts) Packets received in error (Ierrs) Packets transferred (Opkts) Outgoing packets in error (Oerrs) Collisions
A route consists of a destination host or network and a gateway to use when forwarding packets. Direct routes are created automatically for each interface attached to the local host when you issue the ifconfig command. Routes can be modified automatically in response to the prevailing condition of the network.
The routing-table display format indicates available routes and the status of each in the following fields: Displays the state of the route as one or more of the following: Up, or available. This route is to a gateway. This route is to a host This route was dynamically created by a redirect. This route was modified by a redirect. This is a static route that was created by the route command. This is a reject route that was created by the route command. Gives the current number of active uses for the route. Connection-oriented protocols hold on to a single route for the duration of a connection; connectionless protocols obtain routes in the process of sending to a destination. Provides a count of the number of packets sent using the route. Indicates the network interface used for the route.
option is specified, the routing table display
includes the route metrics. An asterisk (*) indicates the metric is locked.
for additional information on routing.
To show the state of the configured interfaces, enter: $ netstat -i To show the routing tables, enter: $ netstat -r
Route Tree for Protocol Family 2:
default 220.127.116.11 UG 13 38618 ln0
localhost 18.104.22.168 UH 2 29 lo0
ethernet 22.214.171.124 U 98 66760 ln0
Route Tree for Protocol Family 2: default 126.96.36.199 UG 0 6004465 tu0 16.140.128/24 188.8.131.52 U 4 181451 tu0 127.0.0.1 127.0.0.1 UH 0 0 lo0 194.224/16 127.0.0.1 UG 0 3 lo0 194.226/16 127.0.0.1 UGR 0 0 lo0 198.119.1/24 184.108.40.206 U 1 867 le0 220.127.116.11/27 18.104.22.168 U 0 1 le0 22.214.171.124 126.96.36.199 UGH 0 0 le0 130.200/16 188.8.131.52 UG 0 0 tu0 To produce the default display for network connections, enter: netstat
Commands: vmstat(1), route(8)