To get external/real IP of a linux server/workstation, just use below command
curl -s http://whatismijnip.nl |cut -d ” ” -f 5
just let’s hope above URL remains up forever
Ref: http://unix.stackexchange.com/questions/22615/how-can-i-get-my-external-ip-address-in-bash