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?

closed as off topic by Michael Hampton, HopelessN00b, Scott Pack, Zoredache, Magellan Oct 28 '12 at 5:13

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • This "airport extreme" is in a role of a WLAN-router, right? So your OS-X-Server is connected via WLAN and gets his IP from just this router? – Nils Oct 27 '12 at 20:16
  • Can you use an SNMP client to fetch the current addresses from the router? is the OID for ipAdEntAddr: if you walk it using snmpwalk or a similar tool it should give you all addresses assigned to the router. You can pick out the dynamic address by removing the known static addresses. – aecolley Oct 27 '12 at 21:00
  • @Nils yes... it's a wlan router and has a reservation with a fixed internal ip for the server. – unom Oct 27 '12 at 21:09
  • 1
    See serverfault.com/questions/89114/… – Zoredache Oct 28 '12 at 0:30

Get a Dynamic DNS service. There are many such services available from various places on the Internet...

  • It is the router that changes - not the server. Strange scenario, though. And they seem to make security by obscurity. – Nils Oct 27 '12 at 20:17
  • That's completely irrelevant. – Michael Hampton Oct 27 '12 at 20:22
  • @Nils "security by obscurity" is one of the best one-liners in a long time, but yes our company has used this in the past... server is under enemy fire... reconnect... can't attack something that's not there. My thoughts on the method is to run a cron job or something every 2 hours or so... with a trace route to say google and have this sent via e-mail to the admin. From time to time when he wants to check in he just looks at the most recent mail. – unom Oct 27 '12 at 21:12
  • In the end i ended up using easydns.com they have a native mac update client and everything works... nice. – unom Nov 8 '12 at 12:26

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.

  1. Open browser.
  2. Visit a website that tells you your IP address.
  3. Script into periodic job for best results.

Alternately, buy a static IP address, but if you just need to know occasionally/just in case, that's how you'd do it. And make sure you set up IPv6/NAT/port-forwarding so the connection actually goes to the server when it hits the gateway.

To quote @MichaelHampton:

Have you deployed IPv6 yet? I'm getting sick of this NAT shit.

  • Your post gave me a "new" idea. Use "back to my mac" to get to the server screen, check ip via a website from there. Brilliant. I'll try that next time i'm onsite. – unom Oct 27 '12 at 21:15

You can set up a cron job to perform the following script:


TIME='date' $TIME
IP='curl http://ifconfig.me/ip' $IP
echo $TIME - $IP >> ~/iplogging.txt

This will output the timestamp and IP at the time the script is ran and log it to ~/iplogging.txt.

Not the answer you're looking for? Browse other questions tagged or ask your own question.