For a long time I'm using excellent FreeDNS.afraid.org as DNS provider. It gives plenty of useful features and of course dynamic DNS support. Below is the Ruby script which I wrote to update dynamic DNS entries. You can start it by a cron job. Additionally the script tries to be nice for FreeDNS by checking if IP needs to be changed, as most of such scripts are doing blind useless updates every 5 minutes and overloading FreeDNS. Moreover script also generates update log with all IP changes.

Before any use you have to obtain UPDATE_URL from Afraid control panel.

#!/usr/bin/ruby

LAST_IP_FILE = "/tmp/last_ip.txt"
LOG_FILE = "/var/log/updateip.log"
CURRENT_IP_URL = "http://checkip.dyndns.org/"
UPDATE_URL = "http://freedns.afraid.org/dynamic/update.php?HASHGOESHERE"

require 'net/http'
require 'uri'
require 'logger'

LOG = Logger.new(LOG_FILE)
LOG.datetime_format = "%Y-%m-%d %H:%M:%S "

begin

  body =  Net::HTTP.get(URI.parse(CURRENT_IP_URL))
  current_ip = (body.match(/\d+.\d+.\d+.\d+/))[0]

  last_ip = ""

 if File.exists? LAST_IP_FILE
   last_ip = File.read(LAST_IP_FILE)
 end

  if last_ip != current_ip
    if Net::HTTP.get_response(URI.parse(UPDATE_URL)).code == "200"
      LOG.info "IP: #{current_ip}"
      File.open(LAST_IP_FILE, 'w') do |out|
        out << current_ip
      end
    end
  end
rescue Timeout::Error
  # ignore - probably lost network connection - will try in next cron cycle
end

And here is example of cron job which executes script every 5 minutes:

*/5 * * * * root  /usr/bin/ruby /opt/bin/updateip.rb