Hacker News new | ask | show | jobs
by mxuribe 694 days ago
The (above) shared url leveraging the cloudflare.com domain name seems to show ip v6 address, while I've noticed that the following defaults to showing ip v4 address: https://1.1.1.1/cdn-cgi/trace

Pick your poison as you wish - either is great! :-)

1 comments

I’d pick the one that supports IPv6 and then make two separate requests to it. One request over IPv4 and one over IPv6.

  curl -4 https://www.cloudflare.com/cdn-cgi/trace

  curl -6 https://www.cloudflare.com/cdn-cgi/trace
Also the reason that the 1.1.1.1 one shows only IPv4 address is because 1.1.1.1 is itself an IPv4 address. So any connection to it will have to be using IPv4.
could you not retrieve your ipv6 directly from the system?
Yes, but getting it in a response from an external server means I don’t have to be specific about which interface to get the IPv6 address of and so on.
the same specific interface used to contact the external server
Which is neatly abstracted away so you don’t have to think about it unless you want to. And therefore reaching out to an external server and having it say where the request came from is the path of least resistance for a script that can work across different hosts with minimal machine specific configuration.

Listen, if you want to check the IPv6 address from the interface list go ahead I’m not trying to stop you.

But because I anyway need to reach a third party to know my own IPv4 address then yeah when that third party can also tell me IPv6 address I’m gonna do it that way.

That requires running it on the router/device which gets the public IP address. By using the service you can update your DNS IP address on a system that is behind the router.
What do you mean?

Every device gets a public ipv6 (usually).

i.e., an arbitrarily-selected interface capable of reaching Cloudflare.