Solaris Application Programming, 1/e - Chapter 4 - Parent Directory
Solaris Application Programming, 1/e - Chapter 4 - Parent Directory
Solaris Application Programming, 1/e - Chapter 4 - Parent Directory
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
70 <strong>Chapter</strong> 4 Informational Tools<br />
4.3.11 Reporting Network Activity (netstat)<br />
netstat can provide a variety of different reports. The -s flag shows statistics per<br />
protocol. A sample of the output showing the statistics for the IPv4 protocol is<br />
shown in Example 4.25.<br />
Example 4.25 Example of netstat -s Output<br />
% netstat -s<br />
...<br />
IPv4 ipForwarding = 2 ipDefaultTTL = 255<br />
ipInReceives =8332869 ipInHdrErrors = 0<br />
ipInAddrErrors = 0 ipInCksumErrs = 0<br />
ipForwDatagrams = 0 ipForwProhibits = 0<br />
ipInUnknownProtos = 2 ipInDiscards = 0<br />
ipInDelivers =8316558 ipOutRequests =13089344<br />
ipOutDiscards = 0 ipOutNoRoutes = 0<br />
ipReasmTimeout = 60 ipReasmReqds = 0<br />
ipReasmOKs = 0 ipReasmFails = 0<br />
ipReasmDuplicates = 0 ipReasmPartDups = 0<br />
ipFragOKs = 0 ipFragFails = 0<br />
ipFragCreates = 0 ipRoutingDiscards = 0<br />
tcpInErrs = 0 udpNoPorts = 17125<br />
udpInCksumErrs = 0 udpInOverflows = 0<br />
rawipInOverflows = 0 ipsecInSucceeded = 0<br />
ipsecInFailed = 0 ipInIPv6 = 0<br />
ipOutIPv6 = 0 ipOutSwitchIPv6 = 213<br />
...<br />
You can obtain a report showing input and output from netstat -i; an example<br />
is shown in Example 4.26. This output shows the number of packets sent and<br />
received, the number of errors, and finally the number of collisions.<br />
Example 4.26 Example of netstat -i Output<br />
% netstat -i 1<br />
input eri0 output input (Total) output<br />
packets errs packets errs colls packets errs packets errs colls<br />
486408174 5 499073054 3 0 530744745 5 543409625 3 0<br />
5 0 9 0 0 12 0 16 0 0<br />
6 0 10 0 0 13 0 17 0 0<br />
6 0 10 0 0 14 0 18 0 0<br />
The collision rate is the number of collisions divided by the number of output<br />
packets. A value greater than about 5% to 10% may indicate a problem. Similarly,<br />
you can calculate error rates by dividing the number of errors by the total input or<br />
output packets. An error rate greater than about one-fourth of a percent may indicate<br />
a problem.