Using traceroute command
The traceroute command in Ubuntu is a network diagnostic tool used to track the path that packets take from the source machine to a destination host across an IP network. It helps in identifying the route taken by packets to reach the destination and in diagnosing where delays or failures occur in the network.
Installation
However, if you need to use traceroute , you can install it using the following command:
sudo apt install traceroute
Basic Usage
To use the traceroute command,type traceroute followed by the hostname or IP address of the target. For example:
traceroute example.com
How It Works
traceroute
works by sending a series of UDP or ICMP packets with incrementally increasing Time-To-Live (TTL) values. The TTL value determines the number of hops (routers) the packet can pass through before being discarded. Each router along the path decreases the TTL by one before forwarding the packet. When the TTL reaches zero, the router discards the packet and sends an ICMP “Time Exceeded” message back to the source. By analyzing these messages, traceroute
can determine the routers’ IP addresses and the round-trip time to each hop.
Common Options
-n: Display numerical addresses instead of resolving hostnames.
-m <max_ttl>: Set the maximum number of hops (TTL value). Default is 30.
-w <timeout>: Set the timeout (in seconds) for each probe.
-I: Use ICMP ECHO instead of UDP datagrams.
-T: Use TCP SYN packets instead of UDP datagrams.
Example
traceroute -n 8.8.8.8