nitefood / asn

ASN / RPKI validity / BGP stats / IPv4v6 / Prefix / URL / ASPath / Organization / IP reputation / IP geolocation / IP fingerprinting / Network recon / lookup API server / Web traceroute server
MIT License
1.31k stars 159 forks source link

IPv6 traceroute refusing to start on my host #43

Closed vmsh0 closed 1 year ago

vmsh0 commented 1 year ago

Hi, First of all, thank you for this amazing script.

I'm opening this issue as IPv6 traceroute doesn't work for me for some reason. When I try to traceroute to e.g. google.com'v IPv6 address, I get:

user@host:~$ ./asn 2a00:1450:4002:402::200e
[... a bunch of correct information ...]
Error: cannot trace an IPv6 from this IPv4-only host!

Similarly, when I run ./asn google.com it performs an IPv4 traceroute, even though the docs say it should perform an IPv6 traceroute when possible.

However, the host is definitely IPv6-enabled: I can successfully ping6 and traceroute6 to the very same address.

I'm gonna take a look myself and see if I can figure out the issue, and then update this issue.

vmsh0 commented 1 year ago

Ok, this is actually an easy one: https://github.com/nitefood/asn/blob/c17b6b01849f43e1f65d70c2ec9f78fef90afc7f/asn#L2583

I'm going to add a flag to force IPv6, because this would be useful to me without making IPv6 my system default. I'm gonna submit it as a PR in case you believe that's something that might be useful to others.

nitefood commented 1 year ago

Hey there @vmsh0!

First of all, thanks a lot for your feedback. I really like the idea of a -6 (and even of a -4, for that matter) command line switch to force v4 or v6 stack usage, so that's definitely going to be included.

Anyway, upon further testing on a dual stack test box, I noticed that indeed the script sometimes fails to detect the presence of IPv6 on the client. I traced this behavior down to unreliable replies from api64.ipify.org when looking up the client's IP. In the past, this used to work just fine (always replied with the IPv6 if present), but that's not the case anymore.

I'd like to ask if you can test a small change, to confirm the script correctly detects IPv6: can you please change this line from:

local_wanip=$(docurl -s "api64.ipify.org")

to:

local_wanip=$(docurl -s "https://ifconfig.co")

and let me know if IPv6 gets consistenly detected now?

Thanks!