User Tools

Site Tools


system:what_is_my_ip_address

What's my source IP as seen from The Internet?

Publicly available resources to check:

http
80
https
443
IPv DNS
53
notes
4 6
y y 4 6 - ifconfig.co/
y y 4 6 - icanhazip.com/ # https://major.io/icanhazip-com-faq/
y y 4 - - ipinfo.io/ip
y y 4 6 - ifconfig.me/
y y 4 - - api.ipify.org/
* y 4 - - echoip.xyz/ # * http redirects to https
y y 4 6 - www.balug.org/myip
y y 4 - - www.ipv4.balug.org/myip
y y - 6 - www.ipv6.balug.org/myip
y * 4 - - whatismyip.akamai.com/ # * cert may not match
* y 4 6 - en.wikipedia.org/wiki/Wikipedia:Get_my_IP_address # long text description, * http redirects to https
- - 4 6 y @ns1.google.com. o-o.myaddr.l.google.com. TXT
- - 4 6 y @resolver1.opendns.com. myip.opendns.com. A myip.opendns.com. AAAA
- - 4 - y @dns.toys ip. TXT # @dns.toys help. TXT # https://www.dns.toys/

Example Usage:

for path in \
  ifconfig.co/ \
  icanhazip.com/ \
  ipinfo.io/ip \
  ifconfig.me/ \
  api.ipify.org/ \
  echoip.xyz/ \
  www.{,ipv{4,6}.}balug.org/myip \
  whatismyip.akamai.com/
do
  for scheme in http https
  do
    for v in 4 6
    do
      r=$(curl -s -"$v" "$scheme://$path")
      if expr x"$r" : x'[.0-9:A-Za-z]\{1,\}$' >>/dev/null; then
        echo "\$ curl -s -$v $scheme://$path"
        echo $r
      elif [ "$scheme" = https ]; then
        r=$(curl -k -s -"$v" "$scheme://$path")
      expr x"$r" : x'[.0-9:A-Za-z]\{1,\}$' >>/dev/null &&
      {
        echo "\$ curl -k -s -$v $scheme://$path"
        echo $r;
      }
      fi
    done
  done
done; echo '$ '

$ curl -s -4 http://ifconfig.co/
96.86.170.226
$ curl -s -6 http://ifconfig.co/
2001:470:67:76f::2
$ curl -s -4 https://ifconfig.co/
96.86.170.226
$ curl -s -6 https://ifconfig.co/
2001:470:67:76f::2
$ curl -s -4 http://icanhazip.com/
96.86.170.226
$ curl -s -6 http://icanhazip.com/
2001:470:67:76f::2
$ curl -s -4 https://icanhazip.com/
96.86.170.226
$ curl -s -6 https://icanhazip.com/
2001:470:67:76f::2
$ curl -s -4 http://ipinfo.io/ip
96.86.170.226
$ curl -s -4 https://ipinfo.io/ip
96.86.170.226
$ curl -s -4 http://ifconfig.me/
96.86.170.226
$ curl -s -4 https://ifconfig.me/
96.86.170.226
$ curl -s -4 http://api.ipify.org/
96.86.170.226
$ curl -s -4 https://api.ipify.org/
96.86.170.226
$ curl -s -4 https://echoip.xyz/
96.86.170.226
$ curl -s -4 http://whatismyip.akamai.com/
96.86.170.226
$ curl -k -s -4 https://whatismyip.akamai.com/
96.86.170.226
$ 

for ns_rr_t_t2 in \
  'ns1.google.com. o-o.myaddr.l.google.com. TXT' \
  'resolver1.opendns.com. myip.opendns.com. A AAAA' \
  'dns.toys ip. TXT'
do
  set -- $ns_rr_t_t2; NS="$1"; RR="$2"; TYPE="$3"; TYPE2="$4"
  query="$RR $TYPE${TYPE2:+ $RR $TYPE2}"
  for v in 4 6
  do
    r=$(dig @"$NS" +short +norecurse -"$v" $query 2>>/dev/null) &&
    [ -n "$r" ] && {
      echo \$ dig @"$NS" +short +norecurse -"$v" $query
      echo $r
    }
  done
  :
done; echo '$ '

$ dig @ns1.google.com. +short +norecurse -4 o-o.myaddr.l.google.com. TXT
"96.86.170.226"
$ dig @ns1.google.com. +short +norecurse -6 o-o.myaddr.l.google.com. TXT
"2001:470:67:76f::2"
$ dig @resolver1.opendns.com. +short +norecurse -4 myip.opendns.com. A myip.opendns.com. AAAA
96.86.170.226
$ dig @resolver1.opendns.com. +short +norecurse -6 myip.opendns.com. A myip.opendns.com. AAAA
2001:470:67:76f::2
$ dig @dns.toys +short +norecurse -4 ip. TXT
"96.86.170.226"
$ 
system/what_is_my_ip_address.txt · Last modified: 2022-06-07T04:00:50+0000 by michael_paoli