I have a OS X Server behind an airport extreme, serving services via opened ports on the airport.
The server has a 10.0.x.x local address, always the same one. The airport extreme gets it’s external IP address via PPPoE, and sometimes… once a week it changes.
For security reasons WE ACTUALLY like this behavior. But i need a way to know the external IP address just in case i need to connect and do something to the server while on the outside.
What can i do?
The site I use for exactly this behaviour is ifconfig.me. This can return data in any format you might want to use.
E.g. In a bash script where you just want the ip:
IP=`curl http://ifconfig.me/ip`
Of course, you’ll want to check the return code in case something goes wrong. It does seem quite robust for scripting, though.
Check more discussion of this question.

