DynDNS at OVH

When you want to use a domain name with dynamic IP address, very often you’ll either have to use one of paid or free providers like dyndns.com,duckdns.org, etc…
But it turns out that most of DNS providers offer dynamic DNS solution, in many cases it’s not very widely advertised.
I use OVH for my domains, and after some time spend looking around, it turns out that they also support dynamic DNS.
There are few steps that you have to follow to get this working:
  1. Create a new DNS entry, type should be: DynHOST
  2. Setup the domain you would like to use, for example: home.yourdomain.com
  3. Destination IP address can be anything at the moment, so set it for example to: 8.8.8.8
  4. Select checkbox to create a “DynHOST identifier”
  5. When creating a DynHOST identifier you’ll have to setup a: user (aka: sufix identifier) and password
  6. You’ll use that credentials in API calls
  7. The url used for OVH API is: https://www.ovh.com/nic/update?system=dyndns

Sample curl commands to change A entry for OVH DynHOST:

curl --user "user:password" "https://www.ovh.com/nic/update?system=dyndns&hostname=home.wlangiewicz.com"
In this case OVH will check what is the source IP address of that HTTP request and set DNS entry accordingly.
You can also pass additional parameter that sets the IP address explicilty:
curl --user "user:password" "https://www.ovh.com/nic/update?system=dyndns&hostname=home.wlangiewicz.com&myip=8.8.8.8"
##Simple bash script:
#!/bin/bash

DYNHOST_USER="my username"
DYNHOST_PASSWD="my password"
DYNHOST_DOMAIN="home.wlangiewicz.com"
OVH_URL="https://www.ovh.com/nic/update?system=dyndns"

run() {
    curl --user "$DYNHOST_USER:$DYNHOST_PASSWD" "${OVH_URL}&hostname=${DYNHOST_DOMAIN}"
}

run

exit $?
I use this script at home, configured in cron to run every 10 minutes.