Dynamic DNS services provide you with a domain name you can use with a non-static IP address, like most home computers have. To use these requires some action to periodically contact the DNS server and let it know if your Dynamic IP address changed. Usually there are complicated scripts provided to do this, and MacOSXHints has published a few.
However one can greatly simplify this with a launchDaemon and a single built in OSX unix command.
First, this assumes that you have set up an account with a Dynamic DNS service. I use the free service provided by FreeDNS. One updates this simply by loading a web page URL. The act of making that page request alerts the DynamicDNS of your IP address and it updates.
Thus all we need is a LaunchDaemon that runs every hour that reloads that page. Here is an example:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>dynamic_dns_updater</string> <key>Disabled</key> <false/> <key>UserName</key> <string>nobody</string> <key>StartInterval</key> <integer>3600</integer> <key>ProgramArguments</key> <array> <string>/usr/bin/curl</string> <string>--silent</string> <string>--insecure</string> <string>https://freedns.afraid.org/dynamic/update.php?YKIJUSiikf83kfj8dhfhuee9jdjd9ejfj99fj9jslRRRT</string> </array> </dict> </plist>
sudo launchctl load /Library/LaunchDaemons/dynamic_dns_updater.plist sudo launchctl start dynamic_dns_updater
sudo launchctl stop dynamic_dns_updater sudo launchctl unload /Library/LaunchDaemons/dynamic_dns_updater.plist rm /Library/LaunchDaemons/dynamic_dns_updater.plist
sudo xattr -d com.apple.quarantine /Library/LaunchDaemons/dynamic_dns_update.plist
Mac OS X Hints
http://hints.macworld.com/article.php?story=20110812232611102