Featured image of post Configure Mikrotik with OVH DynDNS

Configure Mikrotik with OVH DynDNS

Maybe you want to connect to your homelab, or via VPN to your local network. Here we explain you how to configure your Mikrotik to use the OVH DynDNS.

Say you want to connect to your homelab or local network via VPN. This is possible thanks to software like WireGuard or ZeroTier among other older solutions (OpenVPN, PPTP, L2TP)…

Right, but you know that, in order to connect through this kind of software you need the public IP address of the VPN server. If you run this software in your home you probably have a dynamic public IP address assigned, as most of the ISP providers offer out there. So there’s a problem.


Let’s pretend you can connect to your home’s VPN server no matter what IP address it has assigned, without paying an extra cent for it. Wouldn’t you love that? We do so too, and yep, there’s always a way.

The only thing you need to achieve this is your own domain (there are other solutions that don’t involve having a custom domain, but as those are non self-hosteable or fully manageable we won’t be covering them on this post).

With the DynDNS service you can update a type A DNS record when the record’s value changes, automatically, just by setting up a DynDNS client with a given timeout of your liking, say 5 minutes, 10 minutes, or 2 hours.

In this post we’ll explain how to configure your Mikrotik to use the OVH DynDNS feature. Before starting, please follow the link and configure your domain in OVH panel just as the guide says.


Now, we also said this is for Mikrotik router users, so to configure OVH DynDNS in your Mikrotik, this is all we need:

- OVH DynDNS user
- OVH DynDNS password
- OVH DynDNS host (subdomain)
- Mikrotik Interface where is the public ip

To check your current’s Mikrotik public IP address, you can just issue this command via SSH or terminal web:

/ip address print

It will list all the address configured on your Mikrotik. Just look for the one marked with the D flag, that means Dynamic, and check the name of INTERFACE column. In case you have multiple dynamic addresses for whatever reason, look for the one matching the WAN interface.

Setting up the DynDNS client script

Now go to your Mikrotik web interface and browse to the System -> Scripts menu, click on Add new, and fill in the form fields as follows:

- Name: ovh-ddns
- Policy: read, write, test

For the source, you can just copy this script we already tested and tried.

After that click on OK. You need to configure the script, just review the first line and add the configuration we did get before:

:global ovhddnsuser "<OVH DynDNS USER>"
:global ovhddnspass "<OVH DynDNS PASS>"
:global theinterface "<INTERFACE THAT HAS YOUR PUBLIC IP>"
:global ovhddnshost "<OVHDynDNS HOSTNAME>"

Now you can test the script just by applying and clicking on Run Script. If everything is correct, you can see how, on your OVH panel, the DNS record configured with the public IP address has been automatically updated. Maybe you want to use a dig command to check it out. That’s up to you :)

Scheduling the DynDNS script

Right, but here’s the thing. At this point, if you don’t click on the “Run script” button, the script won’t trigger itself. Hopefully that is quite simple to fix: just configure a Scheduler to run this script on a given time basis (say 10 minutes).

To achive this, from your Mikrotik’s web UI, go to System -> Scheduler menu, and click on Add new, then just fill each field with the next details:

- Name: ovh-ddns
- Interval: 00:10:00
- Policy: read, write, test
- On event: /system script run ovh-ddns

If for some reason you prefer setting this up through the cli, just run this command via SSH:

/system scheduler 
add interval=10m name=ovh-ddns on-event="/system script run ovh-ddns" policy=read,write,test start-time=startup

Remember that you can change the interval accordingly to your fit your own needs.

With that, we can say we’re done! You have configured the OVH DynDNS on your Mikrotik, and now you can connect remotely to your home network by pointing your VPN configuration to your very own, automatically updated domain record.

See you next time, don’t forget to share & leave a comment!

Built with Hugo