Understanding Ping and TraceRoute Commands - UnicMinds

Network Basics: Ping and TraceRoute

Ping and traceroute are both network diagnostic tools to understand connectivity between two systems (or IP addresses) on the network. But, they are different from each other in their network objectives. The ping command, as the name says, will test connectivity between two hosts but gives no information on the path between those two hosts. 

Broadly speaking, the ping command is used to check the below:

  • Whether a remote host is active or inactive
  • The round-trip time and delay to communicate with the host
  • Packet loss

The ping command first sends an echo request packet using the ICMP protocol to a target IP address. The ping is successful only when:

  • The echo request gets to the destination
  • The destination system is able to send an echo back to the source within a predetermined time called the timeout. The default value of this timeout is 2 secs.
  • Each packet as a predetermined time-to-live (TTL) that cannot be changed. 

The traceroute command, as the name says, shows the route taken by the packet between the source and the destination displaying all the intermediate hops. The traceroute command is used to discover the routes that packets actually take when they travel to their destination. 

On a Windows machine, this command is called tracert; on Linux and Mac, it’s called traceroute. Traceroute and tracert largely function in the same way—they map the route data takes from one point in a network to a specific IP server. When data is transmitted between two points, it must “hop” through several devices, like switches and routers. Traceroute maps each hop, provides the details and round-trip time (RTT), and gives the device name and IP address where possible.

These tools trace the paths data packets take from their source to their destinations, allowing administrators to better resolve connectivity issues. While ping can tell you if there is a problem, traceroute can help you pinpoint where the problem exists.

More technically speaking, traceroute sends a sequence of packets using the ICMP protocol. The first packet has a time-to-live (TTL or hop limit) of 1, the second packet as a time-to-live (TTL or hop limit) of 2, the third packet has a time-to-live (TTL or hop limit) of 3, and so on. By sending packets in this manner, traceroute ensures that each router in the path will discard the packet and send a response. 

Hope this is useful to gain a basic understanding of how to use the ping command and the traceroute (tracert) command to understand network connectivity between two IP addresses.

You may like to read: Different Types of Ciphers, Encoding in ASCII and UTF, Introduction to NMAP, & Game Ideas in Scratch Programming