Thursday, July 25, 2013

PING - Network Tool Tutorial - 3

Before reading this tutorial please go through Part - 1 & Part - 2

In previous tutorial we seen

ping gives us three major information

-Host Reachability
-Network Congestion
-Time To Live

in that we discussed about what is "Host Reachability", Now we will be seeing Network Congestion

Network Congestion:

Another very precious information provided by the Ping command is the time taken for a packet to reach the destination and come back. This measure is called the RTT (Round Trip Time) or "response time" and is displayed in milliseconds. 
It should not be mistaken for the latency or delay defined as the one-way time taken for a packet to travel across the network between two hosts. 

The response time will affect network applications performance. High response times will lead to poor performances.
When a network application is slow, a first basic troubleshooting step is to get the reponse time between the client and the server to know if the network is the reason of the slowness. 

We should not forget another information related to the response time: the packet loss. A packet is declared as lost if the ICMP message has been discard on the way or if is returned after the timeout value equal to 2 seconds by default. Packet losses will lead to a high TCP retransmission rate with the consequence of a slow or interrupted network application.
In a LAN environment, there shouldn't be any packet loss.

What affects the response time and Packet loss?

-The Network Media
-Network Devices
-Physical Remoteness
-Source and Destination Devices

Time - to - Live

The TTL or Time-To-Live gives you an indication of the number of routers between the source and destination. 
The TTL is used to prevent an IP packet from looping inside an IP network and causing a network meltdown. 
The initial TTL packet value for an IP packet is 255 and then it is decremented by 1 each time it encounters a router. When this value reaches 0, the packet is discarded by a router. The TTL value is contained in each IP packet including ICMP packets. The TTL value given by the ping command is in fact the TTL value of an echo_response packet. 
By default, Windows will decrease the TTL by 128 and Ubuntu Linux by 192.

Let us study three scenarios where A pings B. B is a router (first case), 
A Microsoft Windows machine (case 2) and a Ubuntu Linux machine (case 3). 

The TTL value is initially 255 and then decreased as described as above.

Case 1:
When A pings B, it receives a TTL of 251 because the packets crossed 4 routers (-4).
TTL=255-4=251.  


PING B

Pinging B [1.1.1.1] with 32 bytes of data: 

Reply from 1.1.1.1: bytes=32 time=18 ms TTL=251 
Reply from 1.1.1.1: bytes=32 time=21 ms TTL=251 
Reply from 1.1.1.1: bytes=32 time=20 ms TTL=251 
Reply from 1.1.1.1: bytes=32 time=33 ms TTL=251 

Ping statistics for 1.1.1.1: 
      Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), 
Approximate round trip times in milli-seconds: 
      Minimum = 18ms, Maximum = 33ms, Average = 23ms

-------------------------------------------------------

Case 2:
When A pings B, it receives a TTL of 124 because the packets crossed 3 routers (-3) and a Windows machine (-128).
TTL=255-3-128=124.


PING B

Pinging B [1.1.1.1] with 32 bytes of data: 

Reply from 1.1.1.1: bytes=32 time=18 ms TTL=125 
Reply from 1.1.1.1: bytes=32 time=21 ms TTL=125 
Reply from 1.1.1.1: bytes=32 time=20 ms TTL=125 
Reply from 1.1.1.1: bytes=32 time=33 ms TTL=125 

Ping statistics for 1.1.1.1: 
      Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), 
Approximate round trip times in milli-seconds: 
      Minimum = 18ms, Maximum = 33ms, Average = 23m 

------------------------

Case 3:
When A pings B, it receives a TTL of 62 because the packets crossed 3 routers (-3) and an Ubuntu machine (-192).
TTL=255-3-192=60. 


PING B

Pinging B [1.1.1.1] with 32 bytes of data: 

Reply from 1.1.1.1: bytes=32 time=18 ms TTL=60 
Reply from 1.1.1.1: bytes=32 time=21 ms TTL=60 
Reply from 1.1.1.1: bytes=32 time=20 ms TTL=60 
Reply from 1.1.1.1: bytes=32 time=33 ms TTL=60 

Ping statistics for 1.1.1.1: 
      Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), 
Approximate round trip times in milli-seconds: 
      Minimum = 18ms, Maximum = 33ms, Average = 23ms

-------

Use wireshark to go in-depth analysis of PING Command.

(Taken from openmaniak.com)