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 http://dyndns.com/, http://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:

  • Create a new DNS entry, type should be: DynHOST

  • Setup the domain you would like to use, for example: home.yourdomain.com

  • Destination IP address can be anything at the moment, so set it for example to: 8.8.8.8

  • Select checkbox to create a “DynHOST identifier”

  • When creating a DynHOST identifier you’ll have to setup a: user (aka: sufix identifier) and password

  • You’ll use that credentials in API calls

  • 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.