Get IP
This article list different ways of getting a user's IP address.
Updated: 2017/11/19
Original: 2015/06/07
Polling
Website
Service | Features | URL |
---|---|---|
RIPE | IPv4/IPv6, plain | https://www.ripe.net/@@ipaddress |
ARIN | IPv4/IPv6, plain | https://www.arin.net/simplewebutils/whatsmyip.html |
APNIC | IPv4/IPv6, json | https://cgi1.apnic.net/cgi-bin/my-ip.php |
OpenDNS | IPv4/IPv6, plain | https://diagnostic.opendns.com/myip |
DynDNS | IPv4, html | http://checkip.dyndns.com/ |
SpeedTest | IPv4, xml | http://www.speedtest.net/speedtest-config.php |
Akamai | IPv4, plain | http://whatismyip.akamai.com |
Akamai IPv6 | IPv6, plain | http://ipv6.whatismyip.akamai.com |
Amazon | IPv4, plain | http://checkip.amazonaws.com/ |
DNS
Service | Resolver | Record |
---|---|---|
OpenDNS | resolver1.opendns.com | myip.opendns.com |
Akamai | a6-193.akamaitech.net. | whoami.akamai.net |
Ask resolver1.opendns.com to resolve myip.opendns.com
On Windows :
nslookup myip.opendns.com resolver1.opendns.com
On Linux :
dig +short myip.opendns.com @resolver1.opendns.com
STUN
You can ask a STUN server to provide your external IP address (and the type of your NAT).
Eg.
Using stuntsman :
stunclient.exe stun.stunprotocol.org
WebRTC (in browser)
This will provide an abstraction using RTCPeerConnection.
The browser will check for computer's IP address
and ask Mozilla's STUN server
Checking connectivity
It can be useful to determine whether you are behind a captive
portal (open public Wi-Fi asking for auth).
Before login, all your requests are usually changed.
Techniques by :
- Microsoft, a useful post on StackOverflow
- Google/Android
URL :
http://www.msftncsi.com/ncsi.txt (IPv4)
http://ipv6.msftncsi.com/ncsi.txt (IPv6)
http://clients3.google.com/generate_204