My Mother's IP Address

My 94 year old mother has a 27" imac in her room and lives 200 miles from me. I facetime with her every day and for the past year or so I log onto her computer remotely using Apple Remote Desktop) and answer my own facetime call so that we can talk and see each other.

The only problem is that whenever there is a power failure or her computer restarts the ip address changes and I can no longer log on remotely. Up until a few months ago, I could phone her and walk her through the process to give me the new ip address. Lately this has not worked as well due to her age.

Today I used Keyboard Maestro to do the following (see attached). Whenever the computer restarts (and I have set it to start up every day at 5 am) an apple script application runs that uses the Keyboard Maestro file to:

  1. run firefox (the first tab in firefox is a URL that gets the current ip address
  2. pauses for 60 seconds to allow firefox to run and get the url
  3. takes a screen shot that is saved on the desktop
  4. pauses for 15 seconds
  5. moves the screen shot to a dropbox folder on her computer that is shared with me.

I can then open my dropbox folder and get the new ip address.

Thanks Keyboard Maestro.

5 Likes

Hey Terry,

That's an excellent idea!

You could simplify it quite a bit though.

-Chris


Save Public IP Address to Dropbox.kmmacros (1.7 KB)

4 Likes

Thanks Chris. This is a little over my head but I will play with it a bit tomorrow. I do not understand what the script does

Hey Terry,

It directly saves the public IP address to a dated file in Dropbox and avoids having to monkey around with browsers and screenshots.

This will create a new dated file every time it runs, but you could create 1 file and append to it.

-Chris

By the way most routers would let you nail in place specific devices’ IP addresses. What I’m not sure about is whether that would be visible externally.

Just a thought.

Some years ago I’ve written an AppleScript to constantly log the external IP address.

It appends the result to a log file, like this:

  • It creates a new entry only when the IP Address has changed
  • It is querying different fallback servers when the first one fails to reply (opendns.com, ip-addr.es, ifconfig.me, dyndns.org)
  • It displays a notification
  • It comes with a plist and instructions how to schedule it via launchd (but could also be used with KM)

You can get it here:

4 Likes

When I.P. Changes from yesterday it will Text me and save to log... :slight_smile:

This script works good for me...
If you would like the source please just ask...

Regards,
Bill

Hey Bill,

Well done.  :smile:

You can simplify a bit by changing the Execute an AppleScript action to an Execute a Shell Script action.

As far as I can see the initial curl command is all you need, because it always produces a plain IP-address (at least in my testing).

curl -s http://icanhazip.com

If you do need to filter out just non-digit and non-. characters then it's simpler to use negation.

The caret character ^ when used at the beginning of a range [^…] means NOT.

curl -s http://icanhazip.com | sed 's/[^0-9.]//g'

And by piping the curl result directly to sed you can avoid messing about with temp files on-disk.

NOTE — in your AppleScript the delay command is unnecessary, because execution of the script waits until the result is returned from the do shell script command before moving on to the next statement.

-Chris

3 Likes

Thank you VERY much Chris.

I have duplicated what you have suggested and set it up on my mother's iMac to save her IP Address every 6 hours into a shared folder in her dropbox. I also created an apple script application that will run whenever her computer reboots. This will also save the IP Address into the dropbox folder.

This is very neat and it will encourage me to play with KM more.

3 Likes

Whilst I know this is a KM site, sometimes a screw is a screw, and a hammer won't work...

In view of that, wouldn't an easier option be to set up a DynDNS client on her PC and use the DNS name instead?

No-IP for instance has free accounts for up to 3 DNS names, with a few other restrictions, the worst of which is the requirement to confirm the account every 30 days...

1 Like

Hi everyone, Thanks for share this excellent* idea!

Another option that would drop the requirement for logging IPs would be to set up a zerotier network. It's a bit like a VPN, end-to-end encrypted, and is easier to set up than it would appear.

Basically you run the zerotier client on yours and your Mom's computers, you create a free zerotier account and using their web interface you create and name a zerotier network. Then you use the 16-digit network ID displayed on the web ui and join that network from the zerotier clients on yours and your Mom's (and up to 98 other computers). You can then enable or disable that network at will from the zerotier icon in your menubar.

The result is that you're both assigned IP addresses on that zerotier network, and you'll both be on the same virtual LAN -- it'll feel as if your computer's are on the same local network. Multicast and broadcast work over zerotier by default, so you'd see your Mom's computer in the 'Network' section of a Finder window and could choose to establish a screen sharing or file sharing connection right then and there. You'd never again need to know the IP address her internet provider has assigned her.

1 Like

Whilst I am surprised that you have resurrected and old thread,
I am very grateful as Zerotier looks really interesting.
Zerotier appears to be very simple but an extremely neat solution.

I learned a lot of useful, thank you