[Next] [Previous] [Up] [Top] [Contents]

19.4 Network Programs

19.4.4 netstat - Show Network Status

Report the status of the network, with its interfaces and sockets, with netstat.


netstat [ options ] [ system ] [ core ]

Common Options

-a show status of all sockets, including server processes

-f address_family report only statistics related to the address_family, one of:

inet AF_INET address family

unix AF_UNIX family

-i show status of auto-configured interfaces only

-m show management statistics (or STREAMS statistics, SunOS 5.X only)

-n don't map the IP addresses to host names

-r show the routing tables, or statistics (with -s)

-s show the per-protocol statistics, or routing statistics (with -r)

-g show multicast groups (SunOS 5.X only)

-M show multicast groups (IRIX only)

-p show the address resolution protocol (ARP) statistics (SunOS 5.X only)

-v verbose (SunOS 5.X only)

system defaults to the kernel, e.g. /vmunix

core specify the kernel core file when examining savecore output, e.g. for SunOS 4.1X: system=vmunix.0, core=vmcore.0.


You can check the routes that the machine is actually using with netstat, e.g.:

# netstat -rn

Routing tables

Destination Gateway Flags Refcnt Use Interface UH 1 10007 lo0

default UG 27 55222481 le0 U 29 138605429 le0

The -i option will show the status of the network interfaces, e.g.:

# netstat -i

Name Mtu Net/Dest Address Ipkts Ierrs Opkts Oerrs Collis Queue

le0 1500 server 33168177 864 34382907 19 49045 0

le1 1500 server-gw 25310460 1193 20675896 0 62690 0

lo0 1536 loopback localhost 458882 0 458882 0 0 0


mtu maximum transmission unit

Ipkts Input packets

Ierrs Input errors

Opkts Output Packets

Oerrs Output errors

Collis Collisions

Queue number in the Queue

Often a shortage of buffers can lead to input errors. If the input error rate, Ierrs/Ipkts 0.00025 (0.025%), you may want to experiment with increasing the receive buffers. Here Ierrs/Ipkts is 0.000026 for le0 and 0.000047 for le1.

Network saturation can be investigated by looking at the collision rate, Collis, for a few days. If any of the following are true than one should be concerned.

(Collis + Ierrs + Oerrs)/(Ipkts + Opkts) > 0.02 (2%) (0.0007, .07%)

Collis/Opkts > 0.02 (2%) (0.0014, .14%)

Oerrs > 0%

This may indicate that the network is saturated. Traffic or xtr can give you an indication of the ethernet usage. If it consistently reports 35% utilization then the ethernet segment is saturated and you should look at ways to distribute the load.

The netstat command has a few new options for SunOS 5.X to report on the new TCP/IP features, including IP multicasting. IP multicasting allows the sender to transmit one packet to be received by one or more, but not necessarily all, hosts on a network. This is useful in multi-party communications when sending the same data to multiple destinations. With logical addressing you can send to a service, rather than a host. The default multicast address is The address is permanently assigned to the group of all hosts and gateways participating in IP multicasting. Host groups are identified by this address and interested hosts listen on this address.

Unix System Administration - 8 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]