System Administration Guide, Volume 3

Examples--Checking the Network Status

The following example shows output from the netstat -i command, which displays the state of the interfaces used for TCP/IP traffic.


$ netstat -i
Name  Mtu  Net/Dest    Address      Ipkts  Ierrs Opkts  Oerrs Collis Queue
lo0   8232 software    localhost     1280   0     1280     0       0    0
le0   1500 loopback    venus      1628480   0   347070    16   39354    0

This display shows how many packets a machine has transmitted and received on each interface. A machine with active network traffic should show both Ipkts and Opkts continually increasing.

Calculate the network collisions rate by dividing the number of collision counts (Collis) by the number of out packets (Opkts). In the previous example, the collision rate is 11 percent. A network-wide collision rate greater than 5 to 10 percent can indicate a problem.

Calculate the input packet error rate by dividing the number of input errors by the total number of input packets (Ierrs/Ipkts). The output packet error rate is the number of output errors divided by the total number of output packets (Oerrs/Opkts). If the input error rate is high (over 0.25 percent), the host might be dropping packets.

The following example shows output from the netstat -s command, which displays the per-protocol statistics for the UDP, TCP, ICMP, and IGMP protocols.


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

The following example shows output from the netstat -r command, which displays the IP routing table.


Routing Table:
  Destination        Gateway           Flags  Ref   Use    Interface
------------------ -------------------- ----- ----- ------ ---------
localhost            localhost             UH       0   2817  lo0
earth-bb             pluto                 U        3  14293  le0
224.0.0.0            pluto                 U        3      0  le0
default              mars-gate             UG       0  14142  
 

The fields in the netstat -r report are described in Table 37-2.

Table 37-2 Output From the netstat -r Command

Field Name 

 

Description 

Flags

U

G

H

D

The route is up 

The route is through a gateway 

The route is to a host 

The route was dynamically created using a redirect 

Ref

 

Shows the current number of routes sharing the same link layer 

Use

 

Indicates the number of packets sent out 

Interface

 

Lists the network interface used for the route