Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

tracepath

Show the routers (hops) on the way to a host and the MTU of the path. Needs no root.

Level
Everyday Linux
Group
Network
Needs root
No
Package
iputils

What it does

tracepath sends UDP packets with a growing TTL. Each router that drops a packet answers, so you see the path hop by hop with times. It also finds the path MTU (pmtu).

It works like traceroute but needs no special rights and is installed on RHEL by default (iputils). For a live view use mtr.

How to write it

tracepath [-4] [-6] [-n] [-b] [-l PKTLEN] [-m MAX_HOPS] [-p PORT] DESTINATION

Options 8

Most used

-n
No name lookups: only IP addresses.
-b
Show names and IP addresses.
-4
Use IPv4 only.
-6
Use IPv6 only.
-m MAX_HOPS
Stop after this many hops (default 30).
-l PKTLEN
Start packet length (default 65535 for IPv4, 128000 for IPv6).
-p PORT
Start UDP port.
-V
Show the version.

Examples 10

$ run as a normal user# run as root (or with sudo)

  1. 1Path to a host

    tracepath -n www.redhat.com
     1?: [LOCALHOST]                      pmtu 1500
     1:  192.168.122.1                                         0.512ms
     2:  10.0.0.1                                              2.104ms
     3:  no reply
    ...

    "no reply" = a router that does not answer (common).

  2. 2Names and addresses

    tracepath -b server2.example.com

    Shows both for each hop.

  3. 3Find the path MTU

    tracepath -n 10.20.0.5 | grep pmtu

    A pmtu under 1500 explains hanging SSH or HTTPS over VPN.

  4. 4IPv6 path

    tracepath -6 -n 2001:db8:10::1

    Check IPv6 routes separately from IPv4.

  5. 5Limit the hops

    tracepath -n -m 5 8.8.8.8

    Only the first part of the path (your own network).

  6. 6Compare with the routing table

    ip route get 8.8.8.8
    8.8.8.8 via 192.168.122.1 dev enp1s0 src 192.168.122.10 uid 1000

    The first hop must be this gateway.

  7. 7Check if traffic goes through the VPN

    tracepath -n 10.50.1.10

    The first hop should be the VPN address, not the home router.

  8. 8Save the path for a ticket

    tracepath -n www.example.com > /tmp/path-$(date +%F).txt

    Give it to the network or hosting team.

  9. 9Use a fixed port

    tracepath -p 33434 -n server2

    Some firewalls only allow certain UDP ports.

  10. 10When tracepath stops early

    tracepath -n 192.168.200.5

    Endless "no reply" after hop 1: no route or a firewall after your gateway.

Exit codes

0The destination was reached.
1Not reached or error.

Full manual

This page explains the command in simple words. The original manual has every detail.

In your terminal: man 8 tracepath