What is My External IP all about?
Sometimes, when looking at it from the outside of the network, the IP address of a device seems to be different from the one assigned in the original (sub)network. This is due some mechanisms such as NAT.
My External IP displays the IP address of the device as it seems from the outside (hence external).
News / New Features
- 2013-09-29 activated IPv6
'My External IP' can be reached via IPv6 now as well.
With IPv6 the whole NATting is kind of pointless and most devices will have a 'real' IP address with IPv6 but you still can use myexternalip.com to check if your network works as expexted.
Looks like you are using IPv4.
- 2013-08-16 added 'My-External-Ip' header
Whenever you HEAD http://myexternalip.com, you will find your IP will be there (hint: in the 'my-external-ip' header)!
How to use My External IP
So, how to use this site in your environment (other than just surfing it with a browser)? Here is a list of ideas to get you started:
- NetCat (HEAD)
- BITS (Windows only)
- Powershell 2.0 (Windows only)
- Python (One-Liner) (using 'request') (using 'request' + HEAD)
- Ruby (One-Liner)
- Perl (One-Liner)
to quote from the homepage of 'curl':
curl is a command line tool for transferring data with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, IMAP, SMTP, POP3, RTMP and RTSP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks.
$> curl http://myexternalip.com/raw
to quote from the homepage of 'wget':
GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc.
$> wget -q -O - http://myexternalip.com/raw
often cited as the "Swiss Army Knife for TCP/IP" you can use netcat to obtain your external ip. this approach also works with netcat-alikes such as socat or even with telnet:
$> echo -ne "GET /raw HTTP/1.1\r\n\r\n" | \ nc myexternalip.com 80
NETCAT, HEAD method
just like the regular netcat version, just ask the server to deliver just the HEAD-information
$> echo -ne "HEAD / HTTP/1.1\r\n\r\n" | \ nc myexternalip.com 80
BITS stands for "Background Intelligent Transfer Service", it is a builtin tool of the Windows OS.
$> bitsadmin /transfer "myip" http://myexternalip.com/raw %TEMP%\myip.txt $> type %TEMP%\myip.txt
Powershell is the replacement for the 'old' cmd.exe, it is a builtin of the Windows OS since Windows7 and Windows Server 2008 R2. It is also available as an additional feature for WindowsXP, WindowsVista and Windows Server.
$> $wc = new-object System.Net.WebClient $> $wc.DownloadString("http://myexternalip.com/raw")
$> python -c "import urllib; \ print urllib.urlopen('http://myexternalip.com/raw').read()"
import urllib ip = urllib.urlopen('http://myexternalip.com/raw').read() print ip
Python with 'request'
import requests r = requests.get('http://myexternalip.com/raw') ip = r.text
Python with 'request', HEAD method
import requests r = requests.head('http://myexternalip.com') ip = r.headers['my-external-ip']
$> ruby -e 'require "net/http"; \ Net::HTTP.get_print("http://myexternalip.com", "/raw")'
require 'net/http' ip = Net::HTTP.get('http://myexternalip.com', '/raw') print ip
$> perl -e 'use LWP::Simple; \ print (get "http://myexternalip.com/raw");'
use LWP::Simple; $ip = (get "http://myexternalip.com/raw"); print $ip;
If you whish to contact us, please mail to email@example.com.