Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Geo Traceroute

A traceroute script that probes each hop using both UDP and ICMP simultaneously, resolves hostnames via reverse DNS, and shows geolocation + ISP info for each hop.


What It Does

  • Runs UDP and ICMP traceroute probes to the target at the same time, side by side
  • Shows response time for each protocol per hop
  • Performs reverse DNS lookup to resolve each hop's IP to a hostname (if available)
  • Flags private/local IPs automatically (e.g. router hops) without querying external APIs for them
  • Looks up city, region, country, and ISP for public IPs

This script uses ipwho.is for all geolocation lookups — a free, keyless IP geolocation API.


Requirements / Dependencies

  • traceroute — sends the actual probes
  • curl — makes HTTP requests to the geolocation API
  • jq — parses the JSON response from ipwho.is
  • host (from dnsutils / bind-utils) — resolves IPs to hostnames via reverse DNS

Installation

Clone the repo and make the script executable:

git clone https://github.com/MoradiIT/geo-trace.git
cd geo-trace.sh
chmod +x geo-trace.sh

Installing dependencies

Termux:

pkg install -y traceroute curl jq dnsutils

Debian/Ubuntu:

sudo apt update && sudo apt install -y traceroute curl jq dnsutils

RHEL/CentOS/Fedora:

sudo yum install -y traceroute curl jq bind-utils

Quick install (one line)

sudo apt install -y traceroute curl jq dnsutils && curl -o geo-trace.sh https://raw.githubusercontent.com/MoradiIT/geo-trace/main/geo-trace.sh && chmod +x geo-trace.sh

Usage

./geo-trace.sh <hostname-or-ip>

Examples

./geo-trace.sh google.com
./geo-trace.sh 8.8.8.8

Notes on ICMP

ICMP probing typically requires root privileges. On non-rooted devices (including most Termux setups), the ICMP columns will consistently show NA while UDP results still work normally. This is expected behavior, not a bug — the script does not require root to run.


Information Returned

For each hop, the script displays:

  • UDP and ICMP hop IPs, side by side
  • UDP and ICMP round-trip time
  • Reverse DNS hostname (if one exists for that IP)
  • City, region, country (via ipwho.is)
  • ISP / organization name

Private IP ranges (10.x, 172.16–31.x, 192.168.x, 127.x) are labeled "Local Network" and skip the external API lookup.

Exact geolocation fields depend on ipwho.is's API response and may change over time — see ipwho.is for current documentation.

Response Example

...

11.  UDP: 10.200.2.11      ICMP: 10.200.2.11
     UDP: 203.694ms        ICMP: 169.086ms
NA
Local Network
NA

12.  UDP: NA               ICMP: NA
     UDP: NA               ICMP: NA
Request timed out
NA

13.  UDP: NA               ICMP: 216.239.40.79
     UDP: NA               ICMP: 208.079ms
NA
Paris, Ile-de-France, France
Google LLC

14.  UDP: 142.250.224.198  ICMP: 142.251.64.131
     UDP: 202.020ms        ICMP: 205.149ms
NA
Paris, Ile-de-France, France
Google LLC

15.  UDP: 192.178.96.136   ICMP: 172.217.22.78
     UDP: 195.799ms        ICMP: 168.905ms
NA
Paris, Ile-de-France, France
Google LLC

16.  UDP: 172.217.22.78    ICMP: NA
     UDP: 200.855ms        ICMP: NA
tlv04s05-in-f14.1e100.net
fra15s17-in-f78.1e100.net
tzpara-am-in-f14.1e100.net
fra15s17-in-f14.1e100.net
Paris, Ile-de-France, France
Google LLC

About

Traceroute with simultaneous UDP + ICMP probing, reverse DNS, and IP geolocation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages