Shows network status.
To display active sockets for each protocol or routing table information
netstat [ -num ] [ -protocol protocol ] [ -routtable ] [ -routinfo] [ -state ] [ Interval ]
To display the contents of a network data structure
netstat [ -stats | -cdlistats ] [ -protocol protocol ] [ Interval ]
To display the address resolution protocol (arp)
netstat -arp
To clear all statistics
netstat -clear
The netstat command symbolically displays the contents of various network-related data structures for active connections. The Interval parameter, specified in seconds, continuously displays information regarding packet traffic on the configured network interfaces.
The default display for active sockets shows the following items:
Internet address formats are of the form host.port or network.port if a socket's address specifies a network but no specific host address. The host address is displayed symbolically if the address can be resolved to a symbolic host name, while network addresses are displayed symbolically.
NS addresses are 12-byte quantities, consisting of a 4-byte network number, a 6-byte host number and a 2-byte port number, all stored in network standard format. For VAX architecture, these are word and byte reversed; for the Sun systems, they are not reversed.
If a symbolic name for a host is not known or if the -num flag is used, the address is printed numerically, according to the address family. Unspecified addresses and ports appear as an * (asterisk).
The interface display format provides a table of cumulative statistics for the following items:
The interface display also provides the interface name, number, and address as well as the maximum transmission units (MTUs).
The routing table display indicates the available routes and their statuses. Each route consists of a destination host or network and a gateway to use in forwarding packets.
A route is given in the format A.B.C.D/XX, which presents two pieces of information. A.B.C.D indicates the destination address and XX indicates the netmask associated with the route. The netmask is represented by the number of bits set. For example, the route 9.3.252.192/26 has a netmask of 255.255.255.192, which has 26 bits set.
The routing table contains the following ten fields:
| Flags | The flags field of the routing table shows the state
of the route:
Direct routes are created for each interface attached to the local host. |
| Gateway | The gateway field for these entries shows the address of the outgoing interface. |
| Refs | 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, while connectionless protocols obtain a route while sending to the same destination. |
| Use | Provides a count of the number of packets sent using that route. |
| PMTU | Gives the Path Maximum Transfer Unit (PMTU). |
| Interface | Indicates the network interfaces utilized for the route. |
| Exp | Displays the time (in minutes) remaining before the route expires. |
| Groups | Provides a list of group IDs associated with that route. |
| Netmasks | Lists the netmasks applied on the system. |
| Route Tree for Protocol Family | Specifies the active address families for existing routes.
Supported values for this field are as follows:
|
When a value is specified for the Interval parameter, the netstat command displays a running count of statistics related to network interfaces. This display contains two columns: a column for the primary interface (the first interface found during autoconfiguration) and a column summarizing information for all interfaces. The first line of each screen of information contains a summary of statistics accumulated since the system was last restarted. The subsequent lines of output show values accumulated over intervals of the specified length.
See Virtual I/O Server command exit status.
netstat -routtableThis produces the output similar to the following:
Routing tables Destination Gateway Flags Refs Use If PMTU Exp Groups Route tree for Protocol Family 2 (Internet): default 129.3.141.1 UGc 0 0 en0 - - 129.33.140/23 127.0.0.1 U 6 53 en0 - - 129.33.41.2 localhost UGHS 6 115 lo0 - - 129.45.41.2 129.3.41.1 UGHW 1 602 en0 1500 - dcefs100 129.31.41.1 UGHW 1 2 en0 - - 192.100.61 localhost U 7 14446 lo0 - - Route tree for Protocol Family 24 (Internet v6): ::1 ::1 UH 0 0 lo0 16896 -
netstat -stateThis produces the output similar to the following:
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll en0 1500 link#2 0.5.20.4.0.4e 874986 0 22494 0 0 en0 1500 90.34.14 hostname 874986 0 22494 0 0 lo0 16896 link#1 14581 0 14590 0 0 lo0 16896 129 localhost 14581 0 14590 0 0 lo0 16896 ::1 14581 0 14590 0 0
The mktcpip command, the hostname command, the startnetsvc command, the stopnetsvc command, the cfglnagg command, the entstat command, the cfgnamesrv command, the hostmap command, the traceroute command, the ping command, the optimizenet command.