<chapter id="netmonitor-1"><title>Monitoring Network Performance
(Tasks)</title><highlights><para>This chapter describes the how to monitor network performance.
The following is a list of the step-by-step instructions in this
chapter.</para><itemizedlist><listitem><para><olink targetptr="netmonitor-4" remap="internal">How to Check the
Response of Hosts on the Network</olink></para>
</listitem><listitem><para><olink targetptr="netmonitor-6" remap="internal">How to Send Packets
to Hosts on the Network</olink></para>
</listitem><listitem><para><olink targetptr="netmonitor-8" remap="internal">How to Capture Packets
From the Network</olink></para>
</listitem><listitem><para><olink targetptr="netmonitor-9" remap="internal">How to Check the
Network Status</olink></para>
</listitem><listitem><para><olink targetptr="netmonitor-12" remap="internal">How to Display
NFS Server and Client Statistics</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="netmonitor-2"><title>Monitoring Network Performance</title><para><olink targetptr="netmonitor-3" remap="internal">Table 30&ndash;1</olink> describes
the commands that are available for monitoring network performance.
            </para><table frame="topbot" id="netmonitor-3"><title>Network Monitoring
Commands</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="64.37*"/><colspec colname="column2" colwidth="294.63*"/><thead><row rowsep="1"><entry><para>Command</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><command>ping</command></para>
</entry><entry><para>Look at the response of hosts on the network.</para>
</entry>
</row><row><entry><para><command>spray</command></para>
</entry><entry><para>Test the reliability of your packet sizes. This command can
tell you whether the network is delaying packets or dropping packets.</para>
</entry>
</row><row><entry><para><command>snoop</command></para>
</entry><entry><para>Capture packets from the network and trace the calls from
each client to each server.</para>
</entry>
</row><row><entry><para><command>netstat</command></para>
</entry><entry><para>Display network status, including state of the interfaces
that are used for TCP/IP traffic, the IP routing table, and the
per-protocol statistics for <literal>UDP</literal>, <literal>TCP</literal>, <literal>ICMP</literal>, and <literal>IGMP</literal>.</para>
</entry>
</row><row><entry><para><command>nfsstat</command></para>
</entry><entry><para>Display a summary of server and client statistics that can
be used to identify NFS problems.</para>
</entry>
</row>
</tbody>
</tgroup>
</table><sect2 id="netmonitor-4"><title>How to Check the Response of Hosts
on the Network</title><para>Check the response of hosts on the network with the <command>ping</command> command.</para><screen>$ <userinput>ping</userinput> <replaceable>hostname</replaceable></screen><itemizedlist><para>If you suspect a physical problem, you can use <command>ping</command> to find the response time of several hosts on the network.
If the response from one host is not what you would expect, you
can investigate that host. Physical problems could be caused by
the following:</para><listitem><para>Loose cables or connectors</para>
</listitem><listitem><para>Improper grounding</para>
</listitem><listitem><para>No termination</para>
</listitem><listitem><para>Signal reflection    </para>
</listitem>
</itemizedlist><para>For more information about this command, see <olink targetdoc="refman1m" targetptr="ping-1m" remap="external"><citerefentry><refentrytitle>ping</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><example id="netmonitor-5"><title>Checking the Response of Hosts
on the Network</title><para>The simplest version of <command>ping</command> sends
a single packet to a host on the network. If <command>ping</command> receives
the correct response, the command prints the message <replaceable>host</replaceable> <literal>is alive</literal>.  </para><screen>$ <userinput>ping elvis</userinput>
elvis is alive</screen><para>With the <option>s</option> option, <command>ping</command> sends
one datagram per second to a host. The command then prints each
response and the time that was required for the round trip. An example
follows.</para><screen>$ <userinput>ping -s pluto</userinput>
64 bytes from pluto (123.456.78.90): icmp_seq=0. time=3.82 ms
64 bytes from pluto (123.456.78.90): icmp_seq=5. time=0.947 ms
64 bytes from pluto (123.456.78.90): icmp_seq=6. time=0.855 ms
^C
----pluto PING Statistics----
3 packets transmitted, 3 packets received, 0% packet loss
 
round-trip (ms) min/avg/max/sttdev = 0.855/1.87/3.82/1.7</screen>
</example>
</sect2><sect2 id="netmonitor-6"><title>How to Send Packets to Hosts on
the Network</title><para>Test the reliability of your packet sizes with the <command>spray</command> command.    </para><screen>$ <userinput>spray</userinput> [ -c <replaceable>count</replaceable> -d <replaceable>interval</replaceable> -l <replaceable>packet-size</replaceable>] <replaceable>hostname</replaceable></screen><variablelist><varlistentry><term><option>i</option> <replaceable>count</replaceable></term><listitem><para>Number of packets to send.</para>
</listitem>
</varlistentry><varlistentry><term><option>d</option> <replaceable>interval</replaceable></term><listitem><para>Number of microseconds to pause between sending
packets. If you do not use a delay, you might deplete the buffers.</para>
</listitem>
</varlistentry><varlistentry><term><option>l</option> <replaceable>packet-size</replaceable></term><listitem><para>Is the packet size.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>hostname</replaceable></term><listitem><para>Is the system to send packets.</para>
</listitem>
</varlistentry>
</variablelist><para>For more information about this command, see <olink targetdoc="refman1m" targetptr="spray-1m" remap="external"><citerefentry><refentrytitle>spray</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><example id="netmonitor-7"><title>Sending Packets to Hosts on the
Network</title><para>The following example sends 100 packets to a host (<command>-c
100</command>), with a packet size of 2048 bytes (<command>-l 2048</command>).
The packets are sent with a delay time of 20 microseconds between
each burst (<command>-d 20</command>). </para><screen>$ <userinput>spray -c 100 -d 20 -l 2048 pluto</userinput>
sending 100 packets of length 2048 to pluto ...
no packets dropped by pluto
279 packets/sec, 573043 bytes/sec</screen>
</example>
</sect2><sect2 id="netmonitor-8"><title>How to Capture Packets From the
Network</title><para>To capture packets from the network and trace the calls
from each client to each server, use <command>snoop</command>. This
command provides accurate timestamps that enable some network performance
problems to be isolated quickly. For more information, see <olink targetdoc="refman1m" targetptr="snoop-1m" remap="external"><citerefentry><refentrytitle>snoop</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><screen># <userinput>snoop</userinput></screen><para>Dropped packets could be caused by insufficient buffer
space or an overloaded CPU. </para>
</sect2><sect2 id="netmonitor-9"><title>How to Check the Network Status</title><para>To display network status information, such as statistics
about the state of network interfaces, routing tables, and various
protocols, use the <command>netstat</command> command.</para><screen>$ <userinput>netstat</userinput> [-i] [-r] [-s]</screen><variablelist><varlistentry><term><option>i</option></term><listitem><para>Displays the state of the TCP/IP interfaces</para>
</listitem>
</varlistentry><varlistentry><term><option>r</option></term><listitem><para>Displays the IP routing table</para>
</listitem>
</varlistentry><varlistentry><term><option>s</option></term><listitem><para>Displays statistics for the <literal>UDP</literal>, <literal>TCP</literal>, <literal>ICMP</literal>, and <literal>IGMP</literal> protocols</para>
</listitem>
</varlistentry>
</variablelist><para>For more information, see <olink targetdoc="refman1m" targetptr="netstat-1m" remap="external"><citerefentry><refentrytitle>netstat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><sect3 id="netmonitor-10"><title>Examples&ndash;Checking the Network
Status</title><para>The following example shows output from the <command>netstat
-i</command> command, which displays the state of the interfaces
that are used for TCP/IP traffic. </para><screen>$ <userinput>netstat -i</userinput>
Name  Mtu  Net/Dest    Address      Ipkts  Ierrs Opkts  Oerrs Collis Queue
lo0   8232 software    localhost     1280   0     1280     0       0    0
eri0   1500 loopback    venus      1628480   0   347070    16   39354    0</screen><para>This display shows the number of packets that a machine
has transmitted and has received on each interface. A machine with
active network traffic should show both <literal>Ipkts</literal> and <literal>Opkts</literal> continually increasing. </para><para>Calculate the network collisions rate by dividing the
number of collision counts (<literal>Collis</literal>) by the number
of out packets (<literal>Opkts</literal>). In the previous example,
the collision rate is 11 percent. A network-wide collision rate
that is greater than 5 to 10 percent can indicate a problem.  </para><para>Calculate the error rate for the input packets by dividing
the number of input errors by the total number of input packets
(<literal>Ierrs/Ipkts</literal>). The error rate for the output
packets is the number of output errors divided by the total number
of output packets (<literal>Oerrs/Opkts</literal>). If the input
error rate is high, at over 0.25 percent, the host might be dropping
packets.      </para><para>The following example shows output from the <command>netstat
-s</command>  command, which displays the per-protocol statistics
for the <literal>UDP</literal>, <literal>TCP</literal>, <literal>ICMP</literal>,
and <literal>IGMP</literal> protocols.</para><screen>UDP
    udpInDatagrams      =196543    udpInErrors         =     0
    udpOutDatagrams     =187820
 
TCP
    tcpRtoAlgorithm     =     4    tcpRtoMin           =   200
    tcpRtoMax           = 60000    tcpMaxConn          =    -1
    tcpActiveOpens      = 26952    tcpPassiveOpens     =   420
    tcpAttemptFails     =  1133    tcpEstabResets      =     9
    tcpCurrEstab        =    31    tcpOutSegs          =3957636
    tcpOutDataSegs      =2731494   tcpOutDataBytes     =1865269594
    tcpRetransSegs      = 36186    tcpRetransBytes     =3762520
    tcpOutAck           =1225849   tcpOutAckDelayed    =165044
    tcpOutUrg           =     7    tcpOutWinUpdate     =   315
    tcpOutWinProbe      =     0    tcpOutControl       = 56588
    tcpOutRsts          =   803    tcpOutFastRetrans   =   741
    tcpInSegs           =4587678
    tcpInAckSegs        =2087448   tcpInAckBytes       =1865292802
    tcpInDupAck         =109461    tcpInAckUnsent      =     0
    tcpInInorderSegs    =3877639   tcpInInorderBytes   =-598404107
    tcpInUnorderSegs    = 14756    tcpInUnorderBytes   =17985602
    tcpInDupSegs        =    34    tcpInDupBytes       = 32759
    tcpInPartDupSegs    =   212    tcpInPartDupBytes   =134800
    tcpInPastWinSegs    =     0    tcpInPastWinBytes   =     0
    tcpInWinProbe       =   456    tcpInWinUpdate      =     0
    tcpInClosed         =    99    tcpRttNoUpdate      =  6862
    tcpRttUpdate        =435097    tcpTimRetrans       = 15065
    tcpTimRetransDrop   =    67    tcpTimKeepalive     =   763
    tcpTimKeepaliveProbe=     1    tcpTimKeepaliveDrop =     0

IP
    ipForwarding        =     2    ipDefaultTTL        =   255
    ipInReceives        =11757234  ipInHdrErrors       =     0
    ipInAddrErrors      =     0    ipInCksumErrs       =     0
    ipForwDatagrams     =     0    ipForwProhibits     =     0
    ipInUnknownProtos   =     0    ipInDiscards        =     0
    ipInDelivers        =4784901   ipOutRequests       =4195180
    ipOutDiscards       =     0    ipOutNoRoutes       =     0
    ipReasmTimeout      =    60    ipReasmReqds        =  8723
    ipReasmOKs          =  7565    ipReasmFails        =  1158
    ipReasmDuplicates   =     7    ipReasmPartDups     =     0
    ipFragOKs           = 19938    ipFragFails         =     0
    ipFragCreates       =116953    ipRoutingDiscards   =     0
    tcpInErrs           =     0    udpNoPorts          =6426577
    udpInCksumErrs      =     0    udpInOverflows      =   473
    rawipInOverflows    =     0

ICMP
    icmpInMsgs          =490338    icmpInErrors        =     0
    icmpInCksumErrs     =     0    icmpInUnknowns      =     0
    icmpInDestUnreachs  =   618    icmpInTimeExcds     =   314
    icmpInParmProbs     =     0    icmpInSrcQuenchs    =     0
    icmpInRedirects     =   313    icmpInBadRedirects  =     5
    icmpInEchos         =   477    icmpInEchoReps      =    20
    icmpInTimestamps    =     0    icmpInTimestampReps =     0
    icmpInAddrMasks     =     0    icmpInAddrMaskReps  =     0
    icmpInFragNeeded    =     0    icmpOutMsgs         =   827
    icmpOutDrops        =   103    icmpOutErrors       =     0
    icmpOutDestUnreachs =    94    icmpOutTimeExcds    =   256
    icmpOutParmProbs    =     0    icmpOutSrcQuenchs   =     0
    icmpOutRedirects    =     0    icmpOutEchos        =     0
    icmpOutEchoReps     =   477    icmpOutTimestamps   =     0
    icmpOutTimestampReps=     0    icmpOutAddrMasks    =     0
    icmpOutAddrMaskReps =     0    icmpOutFragNeeded   =     0
    icmpInOverflows     =     0

IGMP:
        0 messages received
        0 messages received with too few bytes
        0 messages received with bad checksum
        0 membership queries received
        0 membership queries received with invalid field(s)
        0 membership reports received
        0 membership reports received with invalid field(s)
        0 membership reports received for groups to which we belong
        0 membership reports sent</screen><para>The following example shows output from the <command>netstat</command>  <option>r</option> command, which displays the IP routing
table.   </para><screen>Routing Table:
  Destination        Gateway           Flags  Ref   Use    Interface
------------------ -------------------- ----- ----- ------ ---------
localhost            localhost             UH       0   2817  lo0
earth-bb             pluto                 U        3  14293  eri0
224.0.0.0            pluto                 U        3      0  eri0
default              mars-gate             UG       0  14142  
 </screen><para>The fields in the <command>netstat</command> <option>r</option> report
are described in <olink targetptr="netmonitor-11" remap="internal">Table 30&ndash;2</olink>. </para><table frame="topbot" id="netmonitor-11"><title>Output From the <command>netstat</command> <option>r</option> Command</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="column1" colwidth="87*"/><colspec colname="column2" colwidth="54*"/><colspec colname="column3" colwidth="216*"/><thead><row rowsep="1"><entry><para>Field Name</para>
</entry><entry><para></para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>Flags</literal> </para>
</entry><entry><para><literal>U</literal></para><para><literal>G</literal></para><para><literal>H</literal></para><para><literal>D</literal></para>
</entry><entry><para>The route is up.</para><para>The route is through a gateway.</para><para>The route is to a host.</para><para>The route was dynamically created by using a redirect.</para>
</entry>
</row><row><entry><para><literal>Ref</literal> </para>
</entry><entry><para></para>
</entry><entry><para>Shows the current number of routes that share the same link
layer.</para>
</entry>
</row><row><entry><para><literal>Use</literal> </para>
</entry><entry><para></para>
</entry><entry><para>Indicates the number of packets that were sent out.</para>
</entry>
</row><row><entry><para><literal>Interface</literal> </para>
</entry><entry><para></para>
</entry><entry><para>Lists the network interface that is used for the route. </para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect3>
</sect2><sect2 id="netmonitor-12"><title>How to Display NFS Server and Client
Statistics</title><para>The NFS distributed file service uses a remote procedure call
(RPC) facility that translates local commands into requests for
the remote host. The remote procedure calls are synchronous. The
client application is blocked or suspended until the server has
completed the call and has returned the results. One of the major
factors that affects NFS performance is the retransmission rate. </para><itemizedlist><para>If the file server cannot respond to a client's request,
the client retransmits the request a specified number of times before
the client quits. Each retransmission imposes system overhead and
increases network traffic. Excessive retransmissions can cause network
performance problems. If the retransmission rate is high, you could
look for the following:</para><listitem><para>Overloaded servers that complete requests too slowly</para>
</listitem><listitem><para>An Ethernet interface that is dropping packets</para>
</listitem><listitem><para>Network congestion, which slows the packet transmission
 </para>
</listitem>
</itemizedlist><para><olink targetptr="netmonitor-13" remap="internal">Table 30&ndash;3</olink> describes
the <command>nfsstat</command> options to display client and server
statistics.</para><table frame="topbot" id="netmonitor-13"><title>Commands for Displaying
Client/Server Statistics</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="108*"/><colspec colname="column2" colwidth="251*"/><thead><row rowsep="1"><entry><para>Command</para>
</entry><entry><para>Display</para>
</entry>
</row>
</thead><tbody><row><entry><para><command>nfsstat -c</command></para>
</entry><entry><para>Client statistics</para>
</entry>
</row><row><entry><para><command>nfsstat -s</command></para>
</entry><entry><para>Server statistics</para>
</entry>
</row><row><entry><para><command>netstat -m</command></para>
</entry><entry><para>Network statistics for each file system</para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>Use <command>nfsstat -c</command> to show client statistics,
and <command>nfsstat -s</command> to show server statistics. Use <command>netstat -m</command> to display network statistics for each file
system. For more information, see <olink targetdoc="refman1m" targetptr="nfsstat-1m" remap="external"><citerefentry><refentrytitle>nfsstat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.         </para><sect3 id="netmonitor-14"><title>Examples&ndash;Displaying NFS Server
and Client Statistics</title><para>The following example displays RPC and NFS data for
the client <literal>pluto</literal>.   </para><screen>$ <userinput>nfsstat -c</userinput>

Client rpc:
Connection oriented:
calls    badcalls  badxids  timeouts newcreds  badverfs   timers     
1595799  1511      59       297      0         0          0          
cantconn nomem     interrupts 
1198      0         7          
Connectionless:
calls    badcalls  retrans  badxids  timeouts  newcreds   badverfs   
80785    3135      25029    193      9543      0          0          
timers   nomem     cantsend   
17399    0         0          

Client nfs:
calls    badcalls  clgets   cltoomany  
1640097  3112      1640097  0          
Version 2: (46366 calls)
null     getattr   setattr  root     lookup     readlink  read       
0 0%     6589 14%  2202 4%  0 0%     11506 24%  0 0%      7654 16%   
wrcache  write     create   remove   rename     link      symlink    
0 0%     13297 28% 1081 2%  0 0%     0 0%       0 0%      0 0%       
mkdir    rmdir     readdir  statfs     
24 0%    0 0%      906 1%   3107 6%    
Version 3: (1585571 calls)
null    getattr    setattr  lookup     access     readlink  read     
0 0%    508406 32% 10209 0% 263441 16% 400845 25% 3065 0%  117959 7%
write    create     mkdir    symlink    mknod    remove   rmdir 
69201 4% 7615 0%    42 0%    16 0%      0 0%     7875 0%  51 0%      
rename   link       readdir  readdir+   fsstat   fsinfo   pathconf   
929 0%   597 0%     3986 0%  185145 11% 942 0%   300 0%   583 0%     
commit     
4364 0%    
 
Client nfs_acl:
Version 2: (3105 calls)
null       getacl     setacl     getattr    access     
0 0%       0 0%       0 0%       3105 100%  0 0%       
Version 3: (5055 calls)
null       getacl     setacl     
0 0%       5055 100%  0 0%    </screen><para>The output of the <command>nfsstat -c</command> command is
described in <olink targetptr="netmonitor-15" remap="internal">Table 30&ndash;4</olink>.</para><table frame="topbot" id="netmonitor-15"><title>Output From the <command>nfsstat -c</command> Command</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="66.72*"/><colspec colname="column2" colwidth="292.28*"/><thead><row rowsep="1"><entry><para>Field</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>calls</literal></para>
</entry><entry><para>The total number of calls that were sent.</para>
</entry>
</row><row><entry><para><literal>badcalls</literal></para>
</entry><entry><para>The total number of calls that were rejected by RPC.</para>
</entry>
</row><row><entry><para><literal>retrans</literal></para>
</entry><entry><para>The total number of retransmissions. For this client, the
number of retransmissions is less than 1 percent, or approximately
10 timeouts out of 6888 calls. These retransmissions might be caused
by temporary failures. Higher rates might indicate a problem.</para>
</entry>
</row><row><entry><para><literal>badxid</literal></para>
</entry><entry><para>The number of times that a duplicate acknowledgment was received
for a single NFS request.</para>
</entry>
</row><row><entry><para><literal>timeout</literal></para>
</entry><entry><para>The number of calls that timed out.</para>
</entry>
</row><row><entry><para><literal>wait</literal> </para>
</entry><entry><para>The number of times a call had to wait because no client handle
was available.</para>
</entry>
</row><row><entry><para><literal>newcred</literal> </para>
</entry><entry><para>The number of times the authentication information had to
be refreshed.</para>
</entry>
</row><row><entry><para><literal>timers</literal> </para>
</entry><entry><para>The number of times the time-out value was greater than or
equal to the specified time-out value for a call.</para>
</entry>
</row><row><entry><para><literal>readlink</literal> </para>
</entry><entry><para>The number of times a <literal>read</literal> was made to
a symbolic link. If this number is high, at over 10 percent, then
there could be too many symbolic links.</para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>The following example shows output from the <command>nfsstat
-m</command> command.</para><screen>pluto$ <userinput>nfsstat -m</userinput>
/usr/man from pluto:/export/svr4/man
Flags: vers=2,proto=udp,auth=unix,hard,intr,dynamic,
        rsize=8192, wsize=8192,retrans=5
 Lookups: srtt=13 (32ms), dev=10 (50ms), cur=6 (120ms)
 All:     srtt=13 (32ms), dev=10 (50ms), cur=6 (120ms)</screen><para>This output of the <command>nfsstat -m</command> command,
which is displayed in milliseconds, is described in <olink targetptr="netmonitor-16" remap="internal">Table 30&ndash;5</olink>.</para><table frame="topbot" id="netmonitor-16"><title>Output From the <command>nfsstat -m</command> Command</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="107*"/><colspec colname="column2" colwidth="252*"/><thead><row rowsep="1"><entry><para>Field</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>srtt</literal> </para>
</entry><entry><para>The smoothed average of the round-trip times</para>
</entry>
</row><row><entry><para><literal>dev</literal></para>
</entry><entry><para>The average deviations</para>
</entry>
</row><row><entry><para><literal>cur</literal></para>
</entry><entry><para>The current &ldquo;expected&rdquo; response time</para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>If you suspect that the hardware components of your
network are creating problems, you need to look closely at the cabling
and connectors.</para>
</sect3>
</sect2>
</sect1>
</chapter>