Very simple way to get external IP and geolocation uysing dig and geoiplookup.
dig is cool to obtain my external IP and I use
geoiplookup to convert IP to location. You need geoip-bin and, geoip-database (and/or geoip-database-contrib and geoip-database-extra). In Debian, database seems update monthly.
It's just a tip.
Bash, 1 line
alias geoloc='geoiplookup $(dig +short myip.opendns.com @resolver1.opendns.com)'
Tags: bash, geocoding, geolocation