Web lists-archives.com

Get the external IP address from a Linux box




Hi,

On 26/05/18 20:53, André Rodier wrote:
> The code is on github, as part of my small homebox project. I am not
> sure it deserves a dedicated repository ;-).
> 
> https://github.com/progmaticltd/homebox/blob/dev-arodier/install/playbo
> oks/roles/system-prepare/files/external-ip

My take from your script is at:

	http://ix.io/1bwE/  [lose the trailing / for the raw file]

NB: I am deliberately using bash instead of dash for a number of reasons....

> It is very simple, but it does what I wanted:
> 
> - Query multiple servers.

My script also does the Google DNS lookup.

> - Count the IP addresses returned, and order them by the most probable
> result.
> - Return the external IP address only if above a certain level of
> confidence (actually 100%).
> - The list of IP addresses is in a separate configuration file.

I've kept the option to use external config file; otherwise it
uses what is known already n the script.


I've used the following for quite some time, but it usually takes too
long (for my liking) to get an answer and it doesn't use https either:

	curl -s ifconfig.me


-- 
Kind Regards
AndrewM



Attachment: signature.asc
Description: OpenPGP digital signature