GitHub - goutamadwant/tracemap: Modern traceroute visualization for the terminal and the web. Table-first (MTR-style) output, interactive TUI, HTML/SVG maps, ASN + GeoIP enrichment, replay, diff, and privacy-aware design. (original) (raw)

Python 3.10+ License: MIT Code style: ruff

A modern traceroute visualizer for the terminal: TUI + interactive HTML maps + ASN/GeoIP lookups.

Table-first output like MTR, with replay/diff workflows for SREs, and beautiful HTML exports for incident reports.

๐Ÿ“ธ Screenshots

Interactive HTML Map Export

HTML Map - Interactive Leaflet.js with hop markers and RTT color coding

Terminal TUI

TUI Interface - Live terminal UI with map, hop table, and metadata


๐Ÿ“‹ Prerequisites

๐Ÿ”‘ Permissions & sudo Requirements

Tracemap uses the system traceroute binary, which often requires root privileges for certain probe types:

Protocol Flag Privileges Required? Notes
UDP Default No (usually) Standard traceroute on macOS/Linux works without root for UDP.
ICMP -P icmp Yes (sudo) Creating raw ICMP sockets requires root.
TCP -P tcp Yes (sudo) Creating raw TCP SYN packets requires root.
Paris --paris No (usually) Uses UDP with fixed ports; similar requirements to default UDP.

Recommendation: Verification commands (like doctor) run fine as a normal user. For advanced tracing (ICMP/TCP), run with sudo:

sudo tracemap trace google.com --protocol icmp

Privacy Note: By default, tracemap queries external GeoIP providers (ip-api.com, ipapi.co) for accurate location data. Use --profile private or --no-api for fully offline operation with no external calls.


โœจ What Makes This Different?

Table-first like MTR, but with maps + export:

โœจ Core Features

๐Ÿ–ฅ๏ธ Modern Terminal Output

๐Ÿ—บ๏ธ Production-Ready Exports

๐ŸŒ Intelligent Geo Lookup (Resilient & Accurate!)

Automatic cascading fallback for maximum reliability:

  1. Primary API: ip-api.com (45 req/min, free)
  2. Backup API: ipapi.co (1000/day, free)
  3. Local Database: MaxMind GeoLite2 (if configured)
  4. Mock Data: Last resort fallback

Why This Matters:

Example Cascading Behavior:

Attempting ip-api.com... โœ“ Success! (used)
โ””โ”€ If failed โ†’ Try ipapi.co... โœ“ Got result
   โ””โ”€ If failed โ†’ Try local MMDB... โœ“ Found
      โ””โ”€ If failed โ†’ Use mock data (always works)

๐Ÿ“Š Network Intelligence & UX

๐Ÿ”ง Developer-Friendly


Quick Start

Basic Trace

Run traceroute with clean table output

tracemap trace google.com

Output: Clean MTR-style table with hops, RTT, geo location

Auto-generates: trace.json + trace.html

Watch Mode (Continuous Monitoring)

Monitor route every 30 seconds (like MTR)

tracemap watch google.com --interval 30

Detects:

- Route changes (IP/ASN shifts)

- RTT spikes (>40% from baseline)

- Packet loss patterns

- Logs to ~/.tracemap/watch_google.com.jsonl

ECMP Detection

Discover multiple paths through load balancers

tracemap trace --discover-paths google.com

Paris traceroute mode (stable flow ID)

tracemap trace --paris google.com

Privacy Modes

Offline mode (no API calls, requires local MMDB)

tracemap trace --profile offline --geoip-mmdb ~/GeoLite2.mmdb google.com

Private mode (no external lookups, full redaction)

tracemap trace --profile private google.com

Fast mode (skip DNS for speed)

tracemap trace --profile fast google.com

Cache Management

View cache statistics

tracemap cache stats

Output: Hit rate, entries, expiry info

Clear cache

tracemap cache clear

Exports

Markdown incident report

tracemap export trace.json --format markdown --out report.md

HTML interactive map

tracemap export trace.json --format html --out map.html

SVG static visualization

tracemap export trace.json --format svg --out diagram.svg

Installation

pip install tracemap

With GeoIP database support

pip install 'tracemap[geoip]'

With ASN lookup support

pip install 'tracemap[asn]'

All optional features

pip install 'tracemap[all]'

For development (includes pytest etc)

pip install -e '.[dev]' python -m pytest

Your First Trace

Simple trace (includes reverse DNS by default!)

tracemap trace google.com

Example output:

Using real-time API geo lookup (ip-api.com)

Tracing to google.com...

โ•ญโ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ

โ”‚1โ”‚ 10.0.0.1 โ”‚ router.local โ”‚ 3.2 ms โ”‚ 0% โ”‚ โ”‚ โ”‚

โ”‚2โ”‚ 68.85.101.1 โ”‚ po-311-ar01... โ”‚ 12.0ms โ”‚ 0% โ”‚ AS7922 (Comcast)โ”‚ San Jose, US โ”‚

...

โ”‚8โ”‚ * โ”‚ โ”‚ - โ”‚100%โ”‚ โ”‚ โ”‚

โ”‚9โ”‚ 142.251.46โ€ฆ โ”‚ sfo03s42-gw... โ”‚ 18.7ms โ”‚ 0% โ”‚ AS15169 (Google)โ”‚ San Fran, US โ”‚

โ•ฐโ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

(18 more timeout hops not shown - destination likely reached or firewalled)

With ASN lookup (enabled by default in most cases)

tracemap trace google.com --asn

Use TCP instead of UDP

tracemap trace example.com --protocol tcp

Launch interactive TUI

tracemap tui .tracemap/trace.json


๐Ÿ“– Usage Guide

Commands

tracemap trace <host>

Run traceroute and visualize the path.

Basic trace

tracemap trace example.com

Customize parameters

tracemap trace example.com
--max-hops 20
--timeout 3
--probes 5
--protocol tcp

Enable ASN lookup and save output

tracemap trace example.com
--asn
--out my-trace.json

Privacy mode (hash IPs)

tracemap trace example.com --redact

Options:

tracemap replay <trace.json>

Replay a saved trace without re-running traceroute.

View in terminal

tracemap replay .tracemap/trace.json

Launch interactive TUI

tracemap replay .tracemap/trace.json --tui

tracemap tui [trace.json]

Launch interactive TUI interface.

Empty TUI

tracemap tui

Load existing trace

tracemap tui .tracemap/trace.json

Keyboard Shortcuts:

tracemap export <trace.json>

Export trace to HTML or SVG.

Export to HTML (interactive map)

tracemap export .tracemap/trace.json --format html --out map.html

Export to SVG (static image)

tracemap export .tracemap/trace.json --format svg --out map.svg

tracemap diff <trace-a.json> <trace-b.json>

Compare two traces to detect route changes.

tracemap diff morning-trace.json evening-trace.json

Example output:

โ”Œโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ # โ”‚ Trace A IP      โ”‚ Trace B IP      โ”‚ Match โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 1 โ”‚ 192.168.1.1     โ”‚ 192.168.1.1     โ”‚   โœ“   โ”‚
โ”‚ 2 โ”‚ 10.0.0.1        โ”‚ 10.0.0.1        โ”‚   โœ“   โ”‚
โ”‚ 3 โ”‚ 203.0.113.1     โ”‚ 198.51.100.1    โ”‚   โœ—   โ”‚  โ† Route changed!
โ”‚ 4 โ”‚ 8.8.8.8         โ”‚ 8.8.8.8         โ”‚   โœ“   โ”‚
โ””โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Found 1 differences

tracemap stats <trace.json>

Show detailed statistics.

tracemap stats .tracemap/trace.json

Example output:

Trace Statistics

Host: google.com
Resolved IP: 142.250.185.46
Protocol: UDP
Started: 2026-01-21 08:00:00+00:00

Hops: 12
  Responded: 10
  Timeouts: 2
  Avg Loss: 8.3%

RTT Statistics:
  Min: 1.2 ms
  Max: 156.8 ms
  Avg: 42.3 ms

Detour Alerts:
  โš ๏ธ Detour detected: hop 5โ†’6 spans 8421km

tracemap doctor

Check system prerequisites.


๐ŸŽจ Example Outputs

The default tracemap trace command shows a clean, MTR-style table:

$ tracemap trace google.com

โ•ญโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ #  โ”‚ IP               โ”‚ Hostname        โ”‚ Avg RTT โ”‚ Loss โ”‚ ASN          โ”‚ Location    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  1 โ”‚ 192.168.1.1      โ”‚ gateway.local   โ”‚   2.1ms โ”‚   0% โ”‚              โ”‚             โ”‚
โ”‚  2 โ”‚ 10.50.1.1        โ”‚                 โ”‚  12.3ms โ”‚   0% โ”‚              โ”‚             โ”‚
โ”‚  3 โ”‚ 68.85.101.5      โ”‚ be-301-ar01.oak โ”‚  15.7ms โ”‚   0% โ”‚ AS7922       โ”‚ Oakland, US โ”‚
โ”‚  4 โ”‚ 162.151.86.57    โ”‚ be-298-ar01.plk โ”‚  22.4ms โ”‚   0% โ”‚ AS7922       โ”‚ San Jose    โ”‚
โ”‚  5 โ”‚ 142.251.65.142   โ”‚ 142.251.65.142  โ”‚  18.9ms โ”‚   0% โ”‚ AS15169      โ”‚ MTV, US     โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โœ“ Saved: .tracemap/trace.json
โœ“ Saved: .tracemap/trace.html

Clean, actionable outputโ€”no endless * * * rows.

ASCII World Map (Optional - use --ascii-map)

Note: ASCII map is deprecated. Use HTML export for best visualization.

tracemap trace google.com --ascii-map

tracemap: google.com (142.250.185.46) hops=12 responded=10 legend: ยท land โ€ข path 0-9 hop markers

                                  ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
    ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท       ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
ยทยทยทยทยทโ€ข โ€ข โ€ข โ€ข โ€ข โ€ขโ€ขโ€ข3 4 56ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท

ยทยทยท 1 2 ยทยทยท 7 8 ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท9 โ€ขยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท 0 ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยท 1ยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยท2ยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ยทยทยทยทยทยทยทยทยท

โš ๏ธ Detour detected: hop 5โ†’6 spans 8421km

Interactive HTML Map

The HTML export creates a self-contained file with:

TUI (Textual)

โ”Œโ”€ World Map โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€ Hop Details โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                          โ”‚โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”“โ”‚
โ”‚    ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท  โ”‚โ”‚ #โ”ƒ IP          โ”ƒ Avg RTT โ”ƒ Loss โ”ƒโ”‚
โ”‚  ยทยทยทยท 1 2 3 4 56ยทยทยทยทยทยทยทยท โ”‚โ”กโ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”ฉโ”‚
โ”‚  ยทยทยทยทยทยทยทยทยทยท  ยทยทยท7 8ยทยท    โ”‚โ”‚ 1โ”‚192.168.1.1  โ”‚   1.2 msโ”‚    0%โ”‚โ”‚
โ”‚    ยทยทยทยทยทยทยทยท    ยทยทยทยท9 ยทยท  โ”‚โ”‚ 2โ”‚ 10.0.0.1    โ”‚   5.3 msโ”‚    0%โ”‚โ”‚
โ”‚      ยทยทยทยทยทยท      ยทยท โ€ข    โ”‚โ”‚ 3โ”‚203.0.113.5  โ”‚  12.1 msโ”‚    0%โ”‚โ”‚
โ”‚        ยทยทยทยท        0 1   โ”‚โ”‚ 4โ”‚203.0.113.17 โ”‚  45.2 msโ”‚   33%โ”‚โ”‚
โ”‚          ยทยท          2   โ”‚โ”‚ 5โ”‚8.8.8.8      โ”‚  42.8 msโ”‚    0%โ”‚โ”‚
โ”‚            ยท             โ”‚โ””โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”Œโ”€ Summary โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Target: google.com                                            โ”‚
โ”‚ Total Hops: 12 | Responded: 10 | Timeouts: 2 | Avg Loss: 8%  โ”‚
โ”‚                                                                โ”‚
โ”‚ โš ๏ธ Alerts:                                                    โ”‚
โ”‚   โ€ข Detour detected: hop 5โ†’6 crosses Atlantic                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
q: Quit | โ†‘/โ†“: Navigate | Enter: Details | e: Export HTML

---

## โš ๏ธ Data Accuracy & Limitations

### GeoIP Location Accuracy

**Important**: Geographic locations are **approximate** and should be used for general path visualization only.

**Why GeoIP can be misleading**:
- ๐ŸŒ **Anycast** - Same IP responds from multiple global locations
- ๐Ÿ”€ **MPLS/Tunnels** - Routers may reply from interfaces not on the forward path  
- ๐Ÿข **Corporate registration** - IP registered at HQ, not actual router location
- ๐ŸŒ **Point-of-Presence abstractions** - Router location โ‰  network path geography
- ๐Ÿ“ก **CGNAT** - Carrier-grade NAT addresses (100.64.0.0/10) have no public geo data

**Confidence indicators** (shown where available):
- โœ… High: ASN + city from multiple sources agree
- โš ๏ธ Medium: API data only, or private IP range
- โŒ Low: Mock/fallback data, or conflicting sources

### Route Interpretation

**Detour alerts** flag large geographic jumps, but these may be normal for:
- Submarine cables (e.g., US โ†’ Asia in single hop)
- Dedicated long-haul circuits  
- MPLS tunnels that obscure intermediate hops

**Always verify critical findings** with network operators or additional measurement tools.

---

## ๐Ÿ†• New in v1.0.0 (โœ… All Implemented)

> **Status Legend**: โœ… Implemented | ๐Ÿงช Experimental | ๐Ÿงญ Planned

### Persistent Caching (3-4x Faster) โœ…
Never hit API rate limits again! SQLite-based caching with automatic TTLs:

```bash
# Caching is automatic and transparent
$ tracemap trace google.com
# First run: 8-12s (API lookups)

$ tracemap trace google.com  
# Second run: 2-3s (cache hits) โšก

$ tracemap cache stats
Hit rate: 92.3% (143 hits, 12 misses)
Valid entries: 239

TTLs: GeoIP 30d, ASN 90d, DNS 24h

Watch Mode (MTR Parity) โœ…

Continuous monitoring with anomaly detection:

$ tracemap watch google.com --interval 30

Live updating table showing:

- Rolling RTT statistics

- Packet loss tracking

- Route change alerts ๐Ÿ”ด

- RTT spike warnings โš ๏ธ

Logs to ~/.tracemap/watch_google.com.jsonl

Detects:

Privacy & Offline Profiles โœ…

Preset configurations for different use cases:

Offline mode - No API calls (requires local MMDB)

$ tracemap trace --profile offline --geoip-mmdb ~/GeoLite2.mmdb google.com

Private mode - Maximum privacy

$ tracemap trace --profile private google.com

- No API calls

- No DNS lookups

- Full IP/hostname redaction

Fast mode - Skip DNS for speed

$ tracemap trace --profile fast google.com

Default mode - Balanced (API + caching)

$ tracemap trace --profile default google.com

Paris Traceroute & ECMP Detection โœ…

Detect load-balanced paths that traditional traceroute misses:

Discover all ECMP paths (multi-flow probing)

$ tracemap trace --discover-paths google.com

โš ๏ธ ECMP detected at 2 hops: Hop 4: 2 paths - 68.85.155.117 - 68.85.155.161 Hop 7: 3 paths - 162.151.86.57 - 162.151.86.89 - 162.151.87.13

Paris mode (stable flow ID)

$ tracemap trace --paris google.com

Confidence Scoring โœ…

Know how trustworthy your geo data is:

Geo Confidence

Plausibility checks:

Markdown Export (Incident Reports) โœ…

Generate clean markdown for tickets:

$ tracemap export trace.json --format markdown --out incident.md

Creates:

Perfect for:


โš™๏ธ Configuration

GeoIP Setup (Automatic with API Fallback!)

tracemap now works out-of-the-box with real geographic locations! No setup required.

How It Works

Cascading Fallback Strategy:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ 1. Try ip-api.com (primary, 45/min free)   โ”‚
โ”‚    โ”œโ”€ Success? Use this! โœ“                  โ”‚
โ”‚    โ””โ”€ Failed? โ†’ Try next...                 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 2. Try ipapi.co (backup, 1000/day free)    โ”‚
โ”‚    โ”œโ”€ Success? Use this! โœ“                  โ”‚
โ”‚    โ””โ”€ Failed? โ†’ Try next...                 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 3. Try local MaxMind DB (if configured)    โ”‚
โ”‚    โ”œโ”€ Success? Use this! โœ“                  โ”‚
โ”‚    โ””โ”€ Failed? โ†’ Try next...                 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 4. Use mock data (always works)            โ”‚
โ”‚    โ””โ”€ Deterministic hash-based locations    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Just run - APIs enabled by default!

tracemap trace google.com

Output:

Using real-time API geo lookup (ip-api.com)

No setup required! Getting real locations...

What you get:

Optional: Local Database (Offline Mode)

For complete privacy or offline use, download the MaxMind database:

Step 1: Download GeoLite2 City

Step 2: Configure tracemap

Set environment variable

export TRACEMAP_GEOIP_MMDB=/path/to/GeoLite2-City.mmdb

Or use CLI flag

tracemap trace google.com --geoip-mmdb /path/to/GeoLite2-City.mmdb

Or disable API completely (offline mode)

tracemap trace google.com --no-api --geoip-mmdb /path/to/GeoLite2-City.mmdb

API Configuration Options

Default: API enabled (ip-api.com โ†’ ipapi.co โ†’ mock)

tracemap trace example.com

Disable API (use local DB or mock only)

tracemap trace example.com --no-api

Hybrid: API + local DB fallback

tracemap trace example.com --geoip-mmdb ~/GeoLite2-City.mmdb

Comparison

Mode Setup Accuracy Privacy Offline Speed
API (default) None High Medium โŒ Medium
Hybrid Download DB Highest Medium Partial Fast
Offline Download DB High High โœ… Fastest

Recommendation: Use the default API mode for most cases. Enable offline mode only if you need complete privacy or work in air-gapped environments.

ASN Database (Optional)

For fastest ASN lookups, install PyASN and download an ASN database:

pip install pyasn

Download and convert RIB data

pyasn_util_download.py --latest pyasn_util_convert.py --single rib.*.bz2 ~/.tracemap/asn.dat

tracemap will automatically use the local database if found, or fall back to Team Cymru DNS lookups.


๐Ÿ”ฌ Advanced Usage

JSON Trace Format

Traces are saved in a structured JSON format for easy processing:

{ "meta": { "tool": "tracemap", "version": "1.0.0", "host": "google.com", "resolved_ip": "142.250.185.46", "protocol": "udp", "max_hops": 30, "probes": 3, "started_at": "2026-01-21T08:00:00Z", "completed_at": "2026-01-21T08:00:42Z" }, "hops": [ { "hop": 1, "ip": "192.168.1.1", "hostname": "router.local", "probes": [ {"rtt_ms": 1.2, "ok": true}, {"rtt_ms": 1.1, "ok": true}, {"rtt_ms": 1.3, "ok": true} ], "geo": { "lat": 37.7749, "lon": -122.4194, "city": "San Francisco", "country": "United States", "country_code": "US", "asn": 7922, "asn_org": "COMCAST" }, "is_private": true, "is_timeout": false } ] }


๐ŸŽฏ Technical Improvements & UX

Smart Timeout Cutoff (MTR-Style)

Problem: Traditional traceroute shows 20+ rows of * * * when destinations are firewalled.

Solution: tracemap intelligently stops after 3 consecutive timeouts and shows a clear summary.

Example:

tracemap trace firewalled.example.com

Output stops cleanly:

โ”‚ 11 โ”‚ 150.222.111.15 โ”‚ ... โ”‚ 14.9 ms โ”‚ 0% โ”‚ ...โ”‚ โ”‚ 12 โ”‚ * โ”‚ โ”‚ - โ”‚ 100%โ”‚ โ”‚ โ† Timeout #1 โ”‚ 13 โ”‚ * โ”‚ โ”‚ - โ”‚ 100%โ”‚ โ”‚ โ† Timeout #2 โ”‚ 14 โ”‚ * โ”‚ โ”‚ - โ”‚ 100%โ”‚ โ”‚ โ† Timeout #3 โ†’ STOP!

(16 more timeout hops not shown - destination likely reached or firewalled)

Benefits:

Reverse DNS Enabled by Default

What: Router hostnames (PTR records) are now resolved automatically.

Why: Makes debugging network issues much easier - see ISP router names instead of just IPs.

Example:

Before (no hostnames):

โ”‚ 3 โ”‚ 68.86.143.157 โ”‚ โ”‚ 15.9 ms โ”‚...โ”‚

After (with hostnames):

โ”‚ 3 โ”‚ 68.86.143.157 โ”‚ po-311-ar01... โ”‚ 15.9 ms โ”‚...โ”‚ โ† Comcast router!

Real hostnames you'll see:

Private IP Detection (Including CGNAT)

Critical Update: Now correctly detects Carrier-Grade NAT addresses (100.64.0.0/10).

What is CGNAT?

Impact: Prevents misleading "Mock data" fallback for CGNAT IPs.

Detection includes:

Example:

CGNAT hop correctly identified as private (no geo lookup attempted)

โ”‚ 2 โ”‚ 100.93.176.130 โ”‚ ... โ”‚ 19.4 ms โ”‚ 67% โ”‚ โ”‚ โ”‚


๐Ÿ”ฌ Advanced Usage

Scripting and Automation

from pathlib import Path import json from tracemap.models import TraceRun from tracemap.export.html import export_html

Load trace

data = json.loads(Path(".tracemap/trace.json").read_text()) trace = TraceRun.model_validate(data)

Check for detours

alerts = trace.get_detour_alerts(distance_threshold_km=5000) if alerts: print(f"โš ๏ธ Route anomaly detected: {alerts[0]}")

Export to HTML

export_html(trace, Path("report.html"))

Analyze RTT

avg_rtt = sum(h.rtt_avg_ms for h in trace.hops if h.rtt_avg_ms) / trace.responded_hops print(f"Average RTT: {avg_rtt:.1f}ms")


๐Ÿ—๏ธ Architecture

src/tracemap/
โ”œโ”€โ”€ cli.py              # Typer CLI (trace, watch, cache, export, diff, stats)
โ”œโ”€โ”€ models.py           # Pydantic models (Hop, TraceRun, TraceMeta)
โ”œโ”€โ”€ trace.py            # Traceroute execution & parsing
โ”œโ”€โ”€ geo.py              # GeoIP locators (Mock, MaxMind)
โ”œโ”€โ”€ geo_api.py          # API geo locators (ip-api, ipapi.co) with cache
โ”œโ”€โ”€ asn.py              # ASN resolvers (Team Cymru, PyASN)
โ”œโ”€โ”€ dns.py              # Reverse DNS lookup with caching
โ”œโ”€โ”€ render.py           # ASCII/tables rendering
โ”œโ”€โ”€ profiles.py         # Privacy/offline profiles โšก NEW v1.0.0
โ”‚
โ”œโ”€โ”€ cache/              # Persistent caching (SQLite) โšก NEW v1.0.0
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ sqlite.py       # 30d/90d/24h TTLs
โ”‚
โ”œโ”€โ”€ watch/              # Continuous monitoring โšก NEW v1.0.0
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ monitor.py      # TraceMonitor with rolling stats
โ”‚   โ””โ”€โ”€ alerts.py       # Anomaly detection
โ”‚
โ”œโ”€โ”€ tui/                # Interactive TUI (Textual)
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ app.py          # TraceMapApp widget
โ”‚
โ”œโ”€โ”€ export/             # Export formats
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ html.py         # Leaflet.js interactive maps
โ”‚   โ”œโ”€โ”€ svg.py          # SVG static diagrams
โ”‚   โ””โ”€โ”€ markdown.py     # Incident reports โšก NEW v1.0.0
โ”‚
โ”œโ”€โ”€ analysis/           # Confidence scoring โšก NEW v1.0.0
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ confidence.py   # Geo confidence & plausibility checks
โ”‚
โ””โ”€โ”€ probing/            # Advanced probing โšก NEW v1.0.0
    โ”œโ”€โ”€ __init__.py
    โ””โ”€โ”€ paris.py        # Paris traceroute & ECMP detection

Key Design Principles


๐Ÿค Contributing

Contributions welcome! Priority areas:

High Impact:

Advanced Features:

Already Implemented (v1.0.0):

See ROADMAP.md for full development plan.


๐Ÿ“œ License

MIT License - see LICENSE for details.


๐Ÿ™ Acknowledgments


๐Ÿ“š See Also


Made with โค๏ธ for network engineers and SREs