On 2017-05-31 11:48, Freek de Kruijf wrote:
Op woensdag 31 mei 2017 11:02:31 CEST schreef Carlos E. R.:
Hi,
In order to get the external IP on a script I used (Dec 2015) this one liner:
wget -qO - checkip.dyndns.org | cut -d":" -f2 | cut -d"<" -f1
and this is failing now (returns empty), but I'm unable (ie, too thick today) to see why. The output of the wget run is:
cer@minas-tirith:~> wget -qO - checkip.dyndns.org <html><head><title>Current IP Check</title></head><body>Current IP Address: 2.141.215.163</body></html> cer@minas-tirith:~>
Something has changed, no idea what.
Meanwhile, looking on google, I got another simpler oneliner (from https://coderwall.com/p/lmi2jw/get-external-ip-in-a-script):
curl http://icanhazip.com
they also suggest using http://ifconfig.me/ip instead, but it fails:
cer@minas-tirith:~> curl http://icanhazip.com 2.141.215.163 cer@minas-tirith:~> curl http://checkip.dyndns.org cer@minas-tirith:~> curl http://ifconfig.me/ip cer@minas-tirith:~>
All sites work on a browser, but only http://icanhazip.com works on the CLI with curl. Why?
On my up-to-date Tumbleweed system all these commands work as they should.
Wow! That's a surprise. What is wrong, then? -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" (Minas Tirith))