Consider a situation when you are not able to access a website and can access other websites. You would want to know if this is a problem with your network, some intermediate network or with web server. How do you figure out?
You can use Traceroute.
What is traceroute?
Traceroute is a widely used command line utility available in almost all operating systems. It shows you the complete route to a destination address. It also shows the time taken (or delays) between intermediate routers. Isn’t it great? Below is an example on Windows operating System.
What does above output mean?
The first column is serial number for intermediate routers. In above output, three packets are sent to every hop to get good estimate of delays for every router. The three columns show time taken by three different packets. The last column is IP/Name of intermediate routers.
The output shows three delay for first hop, followed by delays for second hop and so on.
What is command in Linux and other Operating Systems?
In Windows, as shown above, command name is “tracert”, but in Linux, Unix and Apple MAC OS, command is “traceroute”.
How does traceroute work?
As shown in below diagram, there are intermediate routers between source and destination.

It sends many packets toward the destination.
The first set of packets (3 packets in above example) are sent in a way that they are dropped by first intermediate hop and a control message is received from first intermediate node to get the time estimation for first hop.
The second set of packets (3 packets in above example) are sent in a way that they are dropped by second intermediate hop and a control message is received from second intermediate node to get the time estimation for first hop.
How does traceroute make sure that a packet is dropped at i’th hop?
It uses TTL field for this purpose. TTL is set as 1 for first packet(s), then 2 and so on until destination is reached.
How is total time estimated?
When a packet is dropped, the router sends an ICMP Time Exceeded message back to the source. That is how source figures out total time.
Traceroute is a widely used command line utility in networks.
References:
https://www.youtube.com/watch?v=wTncuOHQbMw&index=5&list=PLkHsKoi6eZnzJl1qTzmvBwTxrSJW4D2Jj
This article is contributed by Rahul Gupta. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Attention reader! Donât stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
Recommended Posts:
- Difference between Ping and Traceroute
- Difference between layer-2 and layer-3 switches
- Difference between Secure Socket Layer (SSL) and Transport Layer Security (TLS)
- Cisco Discovery Protocol (CDP) and Link Layer Discovery Protocol (LLDP) in Data Link Layer
- Computer Networks | Network Layer | Question 1
- Computer Networks | Network Layer | Question 2
- Supernetting in Network Layer
- Fragmentation at Network Layer
- Design Issues in Network Layer
- Network Layer Services- Packetizing, Routing and Forwarding
- Basic Network Attacks in Computer Network
- Difference between Storage Area Network (SAN) and Network Attached Storage (NAS)
- Differences between Wireless Adhoc Network and Wireless Sensor Network
- Difference between Next Generation Network and Traditional Network
- Difference between Software Defined Network and Traditional Network
- Domain Name System (DNS) in Application Layer
- Protocols in Application Layer
- File Transfer Protocol (FTP) in Application Layer
- Multiplexing and Demultiplexing in Transport Layer
- Transport Layer responsibilities


