netstat subcommand

The netstat subcommand symbolically displays the contents of various network-related data structures for active connections.

Format

netstat [-n ] [-D] [-c] [-P] [-m | -s | -ss | -u | -v] [ { -A -a } | { -r -C -i -I Interface } ] [ -f AddressFamily ] [-p Protocol] [-Zc | -Zi | -Zm | -Zs] [Interval] [System]

Parameters

Item Description
-n Shows network addresses as numbers. When the -n flag is not specified, the netstat command interprets addresses where possible and displays them symbolically. This flag can be used with any of the display formats.
-D Shows the number of packets received, transmitted, and dropped in the communications subsystem.
-c Shows the statistics of the Network Buffer Cache.
-P Shows the statistics of the Data Link Provider Interface (DLPI).
-m Shows statistics recorded by the memory management routines.
-s Shows statistics for each protocol.
-ss Displays all of the non-zero protocol statistics and provides a concise display.
-u Displays information about domain sockets.
-v Shows statistics for CDLI-based communications adapters. This flag causes the netstat command to run the statistics commands for the entstat subcommand, the tokstat subcommand, and the fddistat subcommand. No flags are issued to these device driver commands.
-A Shows the address of any protocol control blocks associated with the sockets. This flag acts with the default display and is used for debugging purposes.
-a Shows the state of all of the sockets. Without this flag, sockets used by server processes are not shown.
-r Shows the routing tables. Shows routing statistics when it is used with the -s flag.
-C Shows the routing tables, including the user-configured costs and current costs of each route.
-i Shows the state of all configured interfaces.
-I Interface Shows the state of all of the configured interfaces specified by the Interface variable.
-f AddressFamily Limits reports of statistics or address control blocks to those items specified by the AddressFamily variable. The following address families are recognized:
  • inet – Indicates the AF_INET address family
  • inet6 – Indicates the AF_INET6 address family
  • ns – Indicates the AF_NS address family
  • unix – Indicates the AF_UNIX address family
-p Protocol Shows statistics about the value specified for the Protocol variable, which is either a name for a protocol or an alias for it. Protocol names and aliases are listed in the /etc/protocols file. A null response means that there are no numbers to report. The program report of the value specified for the Protocol variable is unknown if there is no statistics routine for it.
-Zc Clears network buffer cache statistics.
-Zi Clears interface statistics.
-Zm Clears network memory allocator statistics.
-Zs Clears protocol statistics. To clear statistics for a specific protocol, use -p Protocol. For example, to clear the TCP statistics, type the following on the command line:
netstat -Zs -p tcp

Other

No aliases.

Examples

The following is an example of how to use the netstat subcommand:

    <0>netstat -r 

    Route Tree for Protocol Family 2 (Internet): 
    default            advantis.in.ibm.c  UGc    0     0      en0     -   - 
    freezer.austin.i   9.184.199.232      UGHMW  0     1      en0     -   1 
    9.184.192/21       shakti.in.ibm.com  U      20   40546   en0     -   - 
    mqet2.in.ibm.com   9.184.199.12       UGHMW  0     958    en0     -   1 
    127/8              localhost          U      2     249    lo0     -   - 

    Route Tree for Protocol Family 24 (Internet v6): 
    ::1                     ::1           UH     0      0     lo0  16896  -    
    -------------------------------------------------------------------------------