home | list info | list archive | date index | thread index

Re: Routing via US (was Re: Canadian Web Hosting)

Hi Eric,

In order to be sure that the route to the target location does not have sites in the US of A, you have to apply "curl ipinfo.io" to all the addresses in the traceroute or mtr output.

So a loop or script file with a loop would still be needed.

For "manual looping", you can press up arrow and paste the next URL and bang the enter key.

My ISP has some internal "10." addresses before it hits the open universe. Skipping those, I get about 9 addresses.

Sadly, no "one-step script" for this yet.

On 2025-02-07 14:01, Eric Marceau via linux wrote:

Apparently the following will report the country of origin directly at command line:

curl ipinfo.io rogers.com

reports as follows:

{
"ip": "174.116.29.27",
"hostname": "pool-174-116-29-27.cpe.net.cable.rogers.com",
"city": "Ottawa",
"region": "Ontario",
"country": "CA",
"loc": "45.4112,-75.6981",
"org": "AS812 Rogers Communications Canada Inc.",
"postal": "K1R",
"timezone": "America/Toronto",
"readme": "https://ipinfo.io/missingauth"; [1]
}<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a HREF="https://www.rogers.com/"; [2]>here</a></body>

Or, altenately,

curl ipinfo.io rogers.com | grep '"country":' | awk '{ gsub( "\"", "", $0 ) ; print $2 }' | cut -f1 -d,

to get the basic country code,

CA

There is also the option to use this approach:

whois 174.116.29.27 | grep country -i -m 1 | awk '{ print $2 }'

reports

CA

On 2025-02-07 12:28, rob [ at ] echlin [ dot ] ca via linux wrote: mtr can give you the list of IP addresses in a format that puts the IP address in a predictable numbered field.
That can be parsed by grep or awk or Python 4, or whatever.
Or maybe you can turn off all the other data in mtr? Did not check.
Anyway, with that, you can pass the IP addresses in a loop to some geolocation tool.

Sample output of mtr using some params for convenience:
rob@bunny:~$ mtr -n -b -c 1 -r namespro.ca
Start: 2025-02-07T12:30:41-0500
HOST: bunny Loss% Snt Last Avg Best Wrst StDev 1.|-- 192.168.1.1 0.0% 1 2.4 2.4 2.4 2.4 0.0 2.|-- 173.206.0.1 0.0% 1 19.9 19.9 19.9 19.9 0.0 3.|-- 10.201.117.10 0.0% 1 19.7 19.7 19.7 19.7 0.0 4.|-- 10.201.117.73 0.0% 1 20.1 20.1 20.1 20.1 0.0 5.|-- 10.201.121.49 0.0% 1 20.0 20.0 20.0 20.0 0.0 6.|-- 206.80.255.86 0.0% 1 19.4 19.4 19.4 19.4 0.0 7.|-- 206.80.255.6 0.0% 1 19.6 19.6 19.6 19.6 0.0 8.|-- ??? 100.0 1 0.0 0.0 0.0 0.0 0.0 9.|-- 169.53.17.27 0.0% 1 35.9 35.9 35.9 35.9 0.0 10.|-- 169.53.17.35 0.0% 1 39.6 39.6 39.6 39.6 0.0 11.|-- 163.66.118.133 0.0% 1 35.5 35.5 35.5 35.5 0.0 12.|-- 163.66.118.209 0.0% 1 32.6 32.6 32.6 32.6 0.0 13.|-- 158.85.87.71 0.0% 1 34.1 34.1 34.1 34.1 0.0

Your loop has to keep going after number 8 in this list is NOT an IP address.

Rob

On 2025-02-07 11:24, rob [ at ] echlin [ dot ] ca via linux wrote:
The mtr on Ubuntu 22.04 doesn't show any geolocation information, as far as I can tell, looking at the fields listed.

On 2025-02-07 08:52, Richard Guy Briggs via linux wrote:
On 2025-02-07 08:46, James via linux wrote:
Is there a command that will look up the geolocation of every ip in the
traceroute for me?
mtr -t namespro.ca

slainte mhath, RGB

To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
To visit the archives: https://lists.linux-ottawa.org
To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
To visit the archives: https://lists.linux-ottawa.org



Links:
------
[1] https://ipinfo.io/missingauth
[2] https://www.rogers.com/