system:what_is_my_ip_address
This is an old revision of the document!
What's my source IP as seen from The Internet?
Publicly available resources to check:
Example Usage:
for path in \
ifconfig.co/ \
whatismyip.akamai.com/ \
icanhazip.com/ \
ipinfo.io/ip \
ifconfig.me/ \
www.{ipv{4,6}.,}balug.org/myip \
api.ipify.org/ \
self.ip.addr.tools/ \
self6.ip.addr.tools/ \
echoip.xyz/
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://whatismyip.akamai.com/
96.86.170.226
$ curl -k -s -4 https://whatismyip.akamai.com/
96.86.170.226
$ 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://www.ipv4.balug.org/myip
96.86.170.226
$ curl -s -4 https://www.ipv4.balug.org/myip
96.86.170.226
$ curl -s -6 http://www.ipv6.balug.org/myip
2001:470:67:76f::2
$ curl -s -6 https://www.ipv6.balug.org/myip
2001:470:67:76f::2
$ curl -s -4 http://www.balug.org/myip
96.86.170.226
$ curl -s -6 http://www.balug.org/myip
2001:470:67:76f::2
$ curl -s -4 https://www.balug.org/myip
96.86.170.226
$ curl -s -6 https://www.balug.org/myip
2001:470:67:76f::2
$ 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 http://echoip.xyz/
96.86.170.226
$ curl -s -6 http://echoip.xyz/
2001:470:67:76f::2
$ curl -s -4 https://echoip.xyz/
96.86.170.226
$ curl -s -6 https://echoip.xyz/
2001:470:67:76f::2
$
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"
$ dig @dns.toys +short +norecurse -6 ip. TXT
"2001:470:67:76f::2"
$
system/what_is_my_ip_address.1680165278.txt.bz2 · Last modified: 2023-03-30T08:34:38+0000 by michael_paoli