Open In App

tracepath command in Linux with Examples

Last Updated : 05 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The ‘tracepath’ command in Linux is a network diagnostic tool used to trace the path packets take to reach a destination, discovering the Maximum Transmission Unit (MTU) along the way. It operates similarly to the traceroute command but does not require superuser privileges and offers a simpler set of options, making it user-friendly and accessible for basic network troubleshooting. Additionally, ‘tracepath6’ serves as an alternative to traceroute6 for IPv6 addresses, leveraging Linux error queues effectively.

What Does the ‘tracepath’ Command Do?

The primary purpose of the ‘tracepath’ command is to trace the network path to a specified destination and identify the MTU of each hop along the path. This information is valuable for diagnosing network issues, such as packet fragmentation or routing problems. Unlike traceroute, ‘tracepath’ uses a range of UDP ports instead of requiring elevated privileges, making it a safer and more accessible option for regular users.

Syntax:

tracepath [-n] [-b] [-l pktlen] [-m max_hops] [-p port] destination

‘tracepath’ command Example in Linux

tracepath command without any option: It will print the general syntax of the command along with the various options that can be used with the tracepath command as well as gives a brief description about each option.

  • In the following example using tracepath command we are trying to trace path to destination for google.com.
    tracepath www.google.com

Options Available for the tracepath Command

1. tracepath -n

This option prints primarily IP addresses numerically.

Example:

tracepath -n www.google.com

2. tracepath -b

This option print both of host names and IP addresses.

Example:

tracepath -b www.google.com

Lightbox

3. tracepath -l

This option sets the initial packet length to ‘pktlen’ instead of ‘65535’ for ‘tracepath’ or ‘128000’ for ‘tracepath6’.

Example:

tracepath -l 29 www.google.com

Lightbox

4. tracepath -m

This option will set maximum hops (or maximum TTLs) to ‘max_hops’ instead of 30.

Example:

tracepath -m 31 www.google.com

Lightbox

5. tracepath -p

This option will set the initial destination port to use.

Example:

tracepath -p 8080 www.google.com

Lightbox

Conclusion

The ‘tracepath’ command is a simple yet effective tool for network diagnostics in Linux. By tracing the route that packets take to a destination and discovering MTU sizes along the path, it provides valuable insights into network performance and potential issues. Its ease of use, combined with the lack of need for superuser privileges, makes it an ideal choice for both novice and experienced users looking to troubleshoot network connectivity problems.


Next Article
Article Tags :

Similar Reads