MikroTik RouterOS Traceroute: Path Discovery and Diagnostics
MikroTik RouterOS Traceroute: Path Discovery and Diagnostics
Section titled âMikroTik RouterOS Traceroute: Path Discovery and DiagnosticsâRouterOS Version: 6.x / 7.x Difficulty: Beginner Estimated Time: 15 minutes
Overview
Section titled âOverviewâTraceroute reveals the path packets take to reach a destination by exploiting the TTL (Time-To-Live) mechanism. Each router in the path decrements the TTL, and when it reaches zero, the router sends back an ICMP âTime Exceededâ message. By incrementing the TTL with each probe, traceroute maps out every hop along the route.
Use traceroute to diagnose where packets are being dropped, identify routing problems, measure per-hop latency, and understand the path your traffic takes through the network.
How Traceroute Works
Section titled âHow Traceroute WorksâYour Router Hop 1 Hop 2 Destination â â â â ââââ TTL=1 ââââââââââââââââââşâ â â ââââ Time Exceeded ââââââââââ⤠â â â â â â ââââ TTL=2 ââââââââââââââââââşââââââââââââââââşâ â ââââ Time Exceeded ââââââââââââââââââââââââââ⤠â â â â â ââââ TTL=3 ââââââââââââââââââşââââââââââââââââşâââââââââââââââââââşâ ââââ Port Unreachable / Echo Reply âââââââââââââââââââââââââââââââ¤- Router sends packet with TTL=1
- First hop decrements TTL to 0, responds with ICMP âTime Exceededâ
- Router increments TTL and repeats
- Process continues until destination responds
Basic Usage
Section titled âBasic UsageâSimple Traceroute
Section titled âSimple Tracerouteâ/tool traceroute 8.8.8.8Example Output:
# ADDRESS LOSS SENT LAST AVG BEST WORST STD-DEV STATUS 1 192.168.1.1 0% 3 1.2ms 1.1ms 1ms 1.2ms 0.1ms 2 10.0.0.1 0% 3 8.5ms 8.3ms 8ms 9ms 0.5ms 3 72.14.215.85 0% 3 12ms 11ms 10ms 12ms 1ms 4 8.8.8.8 0% 3 14ms 13ms 12ms 14ms 1msOutput columns:
#- Hop number (TTL value)ADDRESS- IP address of the responding routerLOSS- Percentage of probes that timed outSENT- Number of probes sent to this hopLAST- Most recent response timeAVG- Average response timeBEST/WORST- Minimum and maximum response timesSTD-DEV- Standard deviation (consistency measure)
Traceroute with DNS Resolution
Section titled âTraceroute with DNS ResolutionâShow hostnames instead of just IP addresses:
/tool traceroute 8.8.8.8 use-dns=yesIPv6 Traceroute
Section titled âIPv6 Tracerouteâ/tool traceroute 2001:4860:4860::8888Common Parameters
Section titled âCommon Parametersâ| Parameter | Default | Description |
|---|---|---|
protocol | udp | Probe protocol: icmp or udp |
count | 3 | Number of probes per hop |
size | 64 | Packet size in bytes (28-1500) |
timeout | 1s | Wait time for response (1s-8s) |
max-hops | 30 | Maximum number of hops to trace |
src-address | auto | Source IP for probes |
vrf | main | VRF instance (v7) |
routing-table | main | Routing table (v6) |
use-dns | no | Resolve addresses to hostnames |
dscp | 0 | QoS marking for probes |
port | 33434 | Destination port for UDP probes |
Protocol Selection: UDP vs ICMP
Section titled âProtocol Selection: UDP vs ICMPâDefault: UDP
Section titled âDefault: UDPâ/tool traceroute 8.8.8.8 protocol=udpUDP traceroute sends packets to high destination ports (33434+). When the packet reaches the destination, the target returns ICMP âPort Unreachableâ since nothing is listening on that port.
Alternative: ICMP
Section titled âAlternative: ICMPâ/tool traceroute 8.8.8.8 protocol=icmpICMP traceroute sends Echo Request packets. The destination responds with Echo Reply.
When to use which:
- Try UDP first (default)
- If UDP shows timeouts at the destination but ping works, switch to ICMP
- Some enterprise firewalls block UDP traceroute ports but allow ICMP
Advanced Usage
Section titled âAdvanced UsageâSpecify Source Address
Section titled âSpecify Source AddressâFor routers with multiple interfaces, control which source IP is used:
/tool traceroute 8.8.8.8 src-address=192.168.1.1This is important when you need the trace to match the path your actual traffic takes.
Traceroute in VRF (RouterOS 7)
Section titled âTraceroute in VRF (RouterOS 7)â/tool traceroute 10.0.0.1 vrf=customer-vrfTraceroute with Routing Table (RouterOS 6)
Section titled âTraceroute with Routing Table (RouterOS 6)â/tool traceroute 10.0.0.1 routing-table=wan1Extended Timeout for High-Latency Links
Section titled âExtended Timeout for High-Latency LinksâFor satellite or congested links:
/tool traceroute 8.8.8.8 timeout=3sMore Probes for Better Statistics
Section titled âMore Probes for Better Statisticsâ/tool traceroute 8.8.8.8 count=10Test with Larger Packets
Section titled âTest with Larger PacketsâUseful for detecting MTU issues along the path:
/tool traceroute 8.8.8.8 size=1472 protocol=icmpQoS-Marked Traceroute
Section titled âQoS-Marked TracerouteâTest the path for traffic with specific DSCP marking:
/tool traceroute 8.8.8.8 dscp=46Reading Traceroute Output
Section titled âReading Traceroute OutputâSuccessful Trace
Section titled âSuccessful Traceâ # ADDRESS LOSS SENT LAST AVG BEST WORST 1 192.168.1.1 0% 3 1ms 1ms 1ms 1ms 2 10.0.0.1 0% 3 5ms 5ms 4ms 6ms 3 8.8.8.8 0% 3 12ms 11ms 10ms 12msAll hops responding with 0% loss - path is healthy.
Asterisks (Timeouts)
Section titled âAsterisks (Timeouts)â # ADDRESS LOSS SENT LAST AVG BEST WORST 1 192.168.1.1 0% 3 1ms 1ms 1ms 1ms 2 100% 3 3 8.8.8.8 0% 3 12ms 11ms 10ms 12msHop 2 shows asterisks (* * * or 100% loss) but the path works. This is normal - many ISP routers are configured not to respond to TTL exceeded messages to reduce CPU load.
Path Ends with Timeouts
Section titled âPath Ends with Timeoutsâ # ADDRESS LOSS SENT LAST AVG BEST WORST 1 192.168.1.1 0% 3 1ms 1ms 1ms 1ms 2 10.0.0.1 0% 3 5ms 5ms 4ms 6ms 3 100% 3 4 100% 3 5 100% 3If the trace times out at the end and never reaches the destination:
- Destination may be down
- Firewall blocking probe packets
- Try different protocol (
protocol=icmp)
Latency Anomalies
Section titled âLatency Anomaliesâ # ADDRESS LOSS SENT LAST AVG BEST WORST 1 192.168.1.1 0% 3 1ms 1ms 1ms 1ms 2 10.0.0.1 0% 3 50ms 45ms 40ms 50ms 3 8.8.8.8 0% 3 12ms 11ms 10ms 12msHop 2 shows higher latency than the final destination. This seems impossible but is actually common - routers prioritize forwarding packets over generating ICMP responses. The ICMP generation happens in the âslow pathâ and may be rate-limited.
Key insight: Focus on the destination latency, not intermediate hops.
Verification Examples
Section titled âVerification ExamplesâCheck 1: Verify Internet Path
Section titled âCheck 1: Verify Internet Pathâ/tool traceroute 8.8.8.8 count=5Expected: Path completes to destination with reasonable latency.
Check 2: Compare UDP vs ICMP
Section titled âCheck 2: Compare UDP vs ICMPâ/tool traceroute 8.8.8.8 protocol=udp/tool traceroute 8.8.8.8 protocol=icmpExpected: Both should show similar paths. If one fails and the other works, thereâs protocol-specific filtering.
Check 3: Verify VRF Routing
Section titled âCheck 3: Verify VRF Routingâ/tool traceroute 10.0.0.1 vrf=customer-vrfExpected: Path should go through the VRFâs routing table, not the main table.
Troubleshooting
Section titled âTroubleshootingâProblem: âAll hops show asterisksâ
Section titled âProblem: âAll hops show asterisksââCause: Outbound ICMP or UDP blocked by local firewall.
Solution:
- Check firewall rules:
/ip firewall filter print where chain=output - Try different protocol:
protocol=icmporprotocol=udp - Verify basic connectivity:
/ping 8.8.8.8
Problem: âTrace works until destination, then times outâ
Section titled âProblem: âTrace works until destination, then times outââCause: Destination firewall blocks traceroute probes.
Solution:
# Try ICMP if UDP fails/tool traceroute 8.8.8.8 protocol=icmpIf ping works but traceroute doesnât, the destination is reachable but blocking traceroute specifically.
Problem: âDifferent path than expectedâ
Section titled âProblem: âDifferent path than expectedââCause: Asymmetric routing, load balancing, or wrong source address.
Solution:
- Specify source address to match real traffic:
/tool traceroute 8.8.8.8 src-address=YOUR_WAN_IP
- Check routing table:
/ip route print where dst-address=0.0.0.0/0 - For multi-WAN, use the correct routing table/VRF
Problem: âInconsistent results between runsâ
Section titled âProblem: âInconsistent results between runsââCause: Load-balanced paths (ECMP) use per-flow hashing.
Solution: This is expected behavior. Each traceroute may take a different path through load-balanced links. Use the same source/destination port combination for consistent results.
Problem: âVRF traceroute doesnât workâ (RouterOS 7)
Section titled âProblem: âVRF traceroute doesnât workâ (RouterOS 7)âCause: Using wrong parameter name.
Solution: RouterOS 7 uses vrf, RouterOS 6 uses routing-table:
# RouterOS 7/tool traceroute 10.0.0.1 vrf=my-vrf
# RouterOS 6/tool traceroute 10.0.0.1 routing-table=my-tableCommon Pitfalls
Section titled âCommon Pitfallsâ1. Misinterpreting Asterisks
Section titled â1. Misinterpreting AsterisksâWrong: âHop 3 shows * * *, thereâs a problem at hop 3â
Right: Asterisks just mean that router doesnât respond to TTL exceeded. If later hops respond, the path is working.
2. Judging Latency by Intermediate Hops
Section titled â2. Judging Latency by Intermediate HopsâWrong: âHop 2 has 50ms latency, that router is slowâ
Right: ICMP generation is low-priority. Only the final destination latency is meaningful for diagnosing actual traffic performance.
3. Expecting to See Path Through NAT
Section titled â3. Expecting to See Path Through NATâWrong: Expecting to trace the internal path of a remote network
Right: Traceroute can only see up to the NAT device. Internal hops behind NAT are invisible.
4. Forgetting Protocol Differences
Section titled â4. Forgetting Protocol DifferencesâWrong: Only trying UDP when debugging connectivity
Right: Always try both protocols if one fails:
/tool traceroute 8.8.8.8 protocol=udp/tool traceroute 8.8.8.8 protocol=icmp5. Using Default VRF When Testing Specific Path
Section titled â5. Using Default VRF When Testing Specific PathâWrong:
/tool traceroute 10.0.0.1 # Uses main routing tableRight:
/tool traceroute 10.0.0.1 vrf=customer-vrfFirewall Considerations
Section titled âFirewall ConsiderationsâAllowing Traceroute to Your Router
Section titled âAllowing Traceroute to Your RouterâIf you want remote hosts to be able to traceroute to your router:
# Allow ICMP Time Exceeded (for intermediate hops)/ip firewall filter add chain=input action=accept protocol=icmp icmp-options=11:0 comment="ICMP Time Exceeded"
# Allow ICMP Echo Reply (for ICMP traceroute destination)/ip firewall filter add chain=input action=accept protocol=icmp icmp-options=0:0 comment="ICMP Echo Reply"
# Allow UDP traceroute ports (for UDP traceroute destination)/ip firewall filter add chain=input action=accept protocol=udp dst-port=33434-33534 comment="UDP Traceroute"IPv6 Traceroute Firewall Rules
Section titled âIPv6 Traceroute Firewall Rulesâ/ipv6 firewall filter add chain=input action=accept protocol=icmpv6 icmp-options=3:0 comment="ICMPv6 Time Exceeded"/ipv6 firewall filter add chain=input action=accept protocol=udp dst-port=33434-33534 comment="UDP Traceroute"Limitations
Section titled âLimitationsâ- NAT boundaries: Cannot see internal path of NATted networks
- MPLS networks: May hide intermediate hops (label switching)
- Load balancing: Different runs may show different paths
- Rate limiting: Routers may rate-limit ICMP responses, causing apparent loss
- Firewall blocking: Many networks block traceroute probes
- Maximum 30 hops: Default limit, adjustable with
max-hops
Related Topics
Section titled âRelated TopicsâTroubleshooting Tools
Section titled âTroubleshooting Toolsâ- Ping Tool - simple connectivity test
- Torch - real-time traffic analysis
- Packet Sniffer - packet capture
Monitoring
Section titled âMonitoringâ- Netwatch - automated host monitoring
- Bandwidth Test - throughput measurement
Routing
Section titled âRoutingâ- Static Routes - verify route paths
- OSPF - dynamic routing paths