ipv4:

curl -4 icanhazip.com
curl -4 ifconfig.me
curl -4 ident.me
curl https://api.ipify.org

ipv6:

curl -6 icanhazip.com
curl -6 ifconfig.me
curl -6 ident.me
curl https://api64.ipify.org

this last returns IPv6 if available, otherwise IPv4

prioritizes ipv6 over ipv4, but it returns ipv4 to me

If IPv6 throws an error, it’s because you don’t have


with JSON:

curl http://ip-api.com/json
curl ip.guide
curl ipinfo.io