netstat
Appendix B Analysis Tools 147
netstat
The netstat tool gives statistics on the network subsystem. It can be used to
analyze many aspects of the network subsystem, two of which are the TCP/IP
kernel module and the interface bandwidth. An overview of both uses follow.
netstat -I hme0 10
These netstat options are used to analyze interface bandwidth. The upper bound
(max) of the current throughput can be calculated from the output. The upper
bound is reported because the netstat output reports the metric of packets,
which don't necessarily have to be their maximum size. The upper bound of the
bandwidth can be calculated using the following equation:
Bandwidth Used = (Total number of Packets) / (Polling Interval (10) ) ) * MTU
(1500 default).
The current MTU for an interface can be found with: ifconfig -a
netstat -I hme0 10 Output
#netstat -I hme0 10
input hme0 output input (Total) output
packets errs packets errs colls packets errs packets errs colls
122004816 272 159722061 0 0 348585818 2582 440541305 2 2
0 0 0 0 0 84144 0 107695 0 0
0 0 0 0 0 96144 0 123734 0 0
0 0 0 0 0 89373 0 114906 0 0
0 0 0 0 0 84568 0 108759 0 0
0 0 0 0 0 84720 0 108800 0 0
What to Look For
• colls- collisions. If your network is not switched, then a low level of collisions
is expected. As the network becomes increasingly saturated, collision will
increase and eventually will become a bottleneck. The best solution for
collisions is a switched network.