Find file
Fetching contributors…
Cannot retrieve contributors at this time
131 lines (110 sloc) 4.48 KB



Usage: externalip-benchmark


Find what services providing external IP address via http and https are the fastest.

The results were used to tune the externalip script and to recommend good methods in this answer on Stack Exchange:

Results of experiments

The fastest method using DNS:

dig +short

The fastest using HTTP:

curl -s

Not always the fastest, but consistently very fast.

The fastest using HTTPS:

curl -s

Some were faster but with invalid certificates.

Using telnet via nc:

nc 23 | grep IPv4 | cut -d' ' -f4

Using telnet via telnet:

telnet 2>&1 | grep IPv4 | cut -d' ' -f4

Those commands are run by externalip invoked with the following arguments:

externalip dns
externalip http
externalip https
externalip telnet
externalip ftp

Currently externalip telnet uses nc for the connection.

There are a lot of options of different servers providing the external IP especially via HTTP. I made those benchmarks to see if any of them are better than the others and I was surprised by the results. E.g. one of the most widely recommended was almost always the slowest for me, sometimes taking many seconds to respond. Many don't work over HTTPS. Some have invalid certificates.

This is the source of the externalip-benchmark script:

You can run it yourself to see which services mentioned here are worth using:

chmod a+x externalip-benchmark

My results that I got on 2015-04-03 from Warsaw

  • the addresses have been changed to protect the innocent:
0.099s - answer=''
0.107s - answer=''
0.108s - answer=''
0.109s - answer=''
0.114s - answer=''
0.115s - answer=''
0.117s - answer=''
0.295s - answer=''
0.305s - answer=''
0.346s - answer=''
0.352s - answer=''
0.434s - answer=''
0.509s - answer=''
0.509s - answer=''
0.659s - answer=''
0.663s - answer=''
6.114s - answer=''

Best https response times:

0.029s - answer=''
0.029s - answer=''
0.029s - answer=''
0.029s - answer=''
0.080s - answer=''
0.112s - answer=''
0.187s - answer=''
0.204s - answer=''
0.213s - answer=''
0.250s - answer=''
0.440s - answer=''
0.574s - answer='Minimum check interval is 1 minute!NOTE: 10 infractions = banned!'
0.659s - answer=''
0.880s - answer=''
1.322s - answer='You appear to be an automated script. For API details please visit'
5.643s - answer=''
10.001s - answer=''

Best average ping times:

11.078 //
36.828 //
39.288 //
39.796 //
40.586 //
40.883 //
43.659 //
46.781 //
66.198 //
124.038 //
133.978 //
157.306 //
161.243 //
162.871 //
999999 //
999999 //
999999 //

Any important service missing? Please post an issue.