If you want to know everything about the traceroute command, you came to the right place. Here you will learn what is it, why to use it and how.
Traceroute command explained
Traceroute command, just like the rest of the popular network commands, is a simple small software with command-line interface (CLI) and comes built-in on most Linux distros, BSD distros and even macOS.
It is easy to understand its purpose, to trace the route of a query, from your computer, through all the routers (hops) on the way, to the target that you set.
The result will be data on each hop (host name and IP address), showing if the packets of data arrive and after what amount of time, and which was the next hop.
Traceroute options for Windows, Linux, and macOS
The pros of using traceroute
Although it is really small, the traceroute utility software can offer great benefits:
- Small and light. There are other software, more eye-catchy with graphic interface, but the traceroute defend itself with very little size, and fast response.
- Show you the complete route to the target of your choice. It can show each hop with its hostname and IP address, and time it take for each of these points. See the slow router on the way. The information might help you to improve your network, depending if you have control on that particular part of the network infrastructure.
- See the slow router on the way. The information might help you to improve your network, depending if you have control on that particular part of the network infrastructure.
Where can I find the traceroute command?
The traceroute command, just like ping command, dig command, and host command is already pre-built into your OS. You get to the traceroute command, through the Terminal application. Open it and let’s try this out.
You can use it in two ways:
Question structure | Example |
traceroute + hostname | traceroute bing.com |
traceroute + IP address | traceroute 204.79.197.200 |
*We are using bing.com for the example and its IP address. You can use the one you like.
Traceroute syntax
traceroute [options] host_Address [pathlength] (Linux)
Adicional options for refine traceroute command
Use the syntax and these options and you can create better traceroute queries. You can modify many elements including number of packets sent, intervals between them, time to wait, port for the probes, and more.
Option | Description |
–help | Help. |
-d | Debugging. |
-F | No fragmentation allowed. |
-f first_ttl | Set TTL on the first sent packet. . |
-g gateway | Set gateway. |
-i interface | Choose interface for the queries. |
-m max_ttl | Choose the maximum number of hops. If you don’t use this option, the default value is 30. |
-N | The number of simultaneous queries sent. |
-n | Don’t resolve IP addresses. |
-p port | Choose port for the query. |
-t | Choose type-of-service. |
-w waittime | Choose time to wait for replies. |
-q nqueries | Sent the number of packets sent. If you don’t use the option, the default value will be 3. |
-r | If the target is on the same network, bypass the routing tables and send probes directly. |
-S srcaddr | IPv6 only – source address. |
-e | See ICMP extensions. |
-A | AS lookups on for each hop. |
-V | Version of the traceroute command. |
-U | Choose UDP and port for the probes. If you don’t change it, the default value is 53. |
-UL | Choose UDPLITE for the probes. |
-P protocol | Choose IP protocol for the probes. |
-I | Choose ICMP echo for the probes. |
-T | Choose TCP SYN for the probes. |
-4 | Choose IPv4 for the probes. |
-6 | Choose IPv6 for the probes. |
Conclusion
So should you use the traceroute command? It is there already, it works the way it suppose and it is easy to learn. You should at least try it. See if it works for your network diagnostic, and include it in your network diagnostic tool kit. Why not using the traceroute for seeing the complete route to a target, the ping command if you want to check an individual host, or the dig command for other information?