Traceroute is a network diagnostic tool used to identify the path traffic takes between your Linux server and a remote destination.
It can help troubleshoot routing problems, high latency, unreachable destinations and unexpected network paths.
This guide explains how to install and use traceroute on Ubuntu and Debian Linux servers.
Install Traceroute on Ubuntu or Debian
Update the package list:
sudo apt update
Install traceroute:
sudo apt install traceroute -y
Verify the installation:
traceroute --version
Run a Basic Traceroute
To trace the route to an IP address:
traceroute 1.1.1.1
You can also trace a hostname:
traceroute example.com
Traceroute will display the network hops between your server and the destination.
Understanding Traceroute Results
A typical result may look similar to:
1 192.0.2.1 0.5 ms 0.4 ms 0.5 ms
2 198.51.100.1 2.1 ms 2.0 ms 2.2 ms
3 203.0.113.5 8.4 ms 8.2 ms 8.5 ms
Each line represents a network hop.
The numbers displayed in milliseconds (ms) represent the response time for each probe.
Lower latency generally means the network hop is geographically or logically closer, although routing and network architecture can affect the result.
What Does * * * Mean?
Sometimes traceroute displays:
* * *
This does not automatically mean there is a network problem.
Routers may:
- Block traceroute traffic
- Ignore diagnostic packets
- Rate-limit responses
- Deprioritize ICMP traffic
If later hops respond normally and the final destination is reachable, an intermediate * * * is often not a problem.
Disable DNS Resolution
By default, traceroute may attempt to resolve IP addresses to hostnames.
For faster and cleaner output, use:
traceroute -n 1.1.1.1
The -n option prevents DNS lookups and displays only IP addresses.
This can also be useful when sharing troubleshooting results with a hosting provider or network administrator.
Use ICMP Traceroute
Standard Linux traceroute commonly uses UDP probes.
You can perform an ICMP-based traceroute with:
sudo traceroute -I example.com
Different networks may handle UDP and ICMP traffic differently.
If a normal traceroute does not provide useful results, testing with ICMP may help.
Use TCP Traceroute
You can also test using TCP:
sudo traceroute -T -p 443 example.com
This uses TCP port 443.
TCP traceroute can be useful when normal traceroute traffic is filtered but HTTPS traffic is allowed.
Change the Maximum Number of Hops
Traceroute normally stops after a maximum number of hops.
You can change this value using:
traceroute -m 20 example.com
This limits the test to 20 hops.
Test IPv4
To explicitly use IPv4:
traceroute -4 example.com
Test IPv6
If your server has IPv6 connectivity:
traceroute -6 example.com
You can also trace directly to an IPv6 address.
IPv4 and IPv6 traffic may follow completely different network paths.
High Latency on One Hop
High latency at a single intermediate hop does not necessarily indicate a problem.
Some routers give low priority to diagnostic traffic.
For example, if one hop shows:
150 ms
but the following hops and final destination return to:
20 ms
the intermediate router may simply be responding slowly to traceroute probes.
More attention should be given when increased latency begins at one hop and continues through subsequent hops to the final destination.
Traceroute Stops Before the Destination
A traceroute may stop before reaching the destination because of:
- Firewall filtering
- Router configuration
- ICMP filtering
- Network policies
- Routing problems
- Destination filtering
This does not always mean the destination itself is unreachable.
Test normal connectivity separately.
For example:
ping -c 4 example.com
or test the required application port.
Check the Server Routing Table
If traffic appears to be leaving through an unexpected route, check the Linux routing table:
ip route
For IPv6:
ip -6 route
Check which route Linux will use for a specific destination:
ip route get 1.1.1.1
This displays information such as the selected gateway, interface and source IP address.
Traceroute vs MTR
Traceroute provides a snapshot of the route at a specific moment.
MTR continuously tests the route and collects statistics over time.
Use traceroute when you want to:
- Quickly inspect a network path
- Identify network hops
- Check unexpected routing
Use MTR when you want to investigate:
- Packet loss
- Latency over time
- Intermittent network problems
- Route stability
For persistent network problems, an MTR report is generally more useful than a single traceroute.
Traceroute vs iperf3
Traceroute and iperf3 perform different tasks.
Traceroute shows the network path between two systems.
iperf3 measures network throughput between two endpoints.
A slow iperf3 result does not automatically identify where the problem occurs. Combining iperf3, traceroute and MTR can provide a much better picture of network performance.
Troubleshooting a Slow Server Connection
If a server appears to have network problems, a basic troubleshooting sequence is:
Check the server IP configuration:
ip addr
Check routing:
ip route
Test connectivity:
ping -c 10 1.1.1.1
Check the route:
traceroute -n 1.1.1.1
Run a longer network analysis:
mtr -n -rw -c 100 1.1.1.1
If you control another server, test throughput with iperf3.
Information to Provide When Reporting a Network Issue
When contacting a hosting provider or network administrator, provide:
- Source IP address
- Destination IP address
- Date and approximate time of the issue
- Traceroute
- MTR report
- Reverse traceroute or MTR when available
- Description of the problem
- Whether the problem is continuous or intermittent
Providing complete network diagnostics can significantly reduce troubleshooting time.
IDONCLOUD Network Infrastructure
IDONCLOUD provides VPS and Dedicated Server infrastructure with IPv4, IPv6 and high-bandwidth connectivity.
Our Knowledge Base contains practical networking and Linux guides for configuring, testing and troubleshooting server infrastructure.
Visit idoncloud.com to explore IDONCLOUD infrastructure.
Related Guides
- How to Diagnose Packet Loss with MTR on Linux
- How to Test Network Speed on a Linux Server with iperf3
- How to Check Open Ports on a Linux Server
- How to Check Network Interface Speed on Linux
- How to Configure a Static IP Address on Ubuntu with Netplan