DNS Beacon
DashboardSign in

DynDNS on MikroTik RouterOS: step-by-step setup

MikroTik routers ship without a DynDNS2 client — the IP Cloud feature only talks to MikroTik's own service. With a small RouterOS script and the scheduler your router still calls the DNS Beacon update itself and stays reachable under a permanent hostname even when your WAN IP changes. Here's how to set it up.

Step by step

  1. In WinBox under System → Scripts (or in the terminal via /system script add), create a new script named dnsbeacon with the policies read, write, test. Paste the two script lines from the table below as its source and replace ether1 with your WAN interface, plus <email> and <api-key> with your account email and an API key from the dashboard.
  2. Under System → Scheduler, add a schedule that runs the script every 5 minutes — the scheduler command from the table does this in one line in the terminal. The scheduler needs the same policies as the script.
  3. Run the script once by hand (Run Script or /system script run dnsbeacon). The log shows "dnsbeacon: good <IP>" — or nochg if the IP is already correct. From now on the scheduler keeps the hostname up to date automatically.

Settings to enter

System → Scripts and System → Scheduler (WinBox or terminal)

WAN interface:
interface that holds the public IP, e.g. ether1 or pppoe-out1 (replace ether1 in the script)
Hostname:
myhouse.dnsfollowme.uk
Username:
your email address (<email> in the script)
Password:
your API key (<api-key> in the script)
Script, line 1:
:local a [/ip address get [find interface=ether1] address]; :local ip [:pick $a 0 [:find $a "/"]]
Script, line 2:
:local r [/tool fetch url="https://api.dnsbeacon.com/nic/update?hostname=myhouse.dnsfollowme.uk&myip=$ip" user="<email>" password="<api-key>" output=user as-value]; :log info ("dnsbeacon: " . ($r->"data"))
Scheduler:
/system scheduler add name=dnsbeacon interval=5m on-event=dnsbeacon policy=read,write,test
IPv6:
In line 1 replace /ip address with /ipv6 address and [find interface=ether1] with [find interface=ether1 global]; in line 2 send &myipv6=$ip instead of &myip=$ip.

RouterOS has no built-in DynDNS2 client — IP Cloud only talks to MikroTik's own service. A two-line script does the update instead: line 1 reads the IP of the WAN interface, line 2 calls /nic/update via /tool fetch with HTTP basic auth and writes the response to the log. On DSL/PPPoE the WAN interface is usually pppoe-out1. Behind CGNAT/DS-Lite the WAN IP is private and unreachable over IPv4 anyway — send myipv6 with the global IPv6 address instead. Applies to RouterOS 7 (and 6.45+).

IPv4 or IPv6?

The values above update the IPv4 address (A record) — the normal case on connections with their own public IPv4. For IPv6 (AAAA record) the device sends the parameter &myipv6=<IPv6> in addition or instead. How to do that on this device is in the "IPv6" row of the table.

DS-Lite or CGNAT (many cable and fibre connections): the router then has no public IPv4, and the service rejects a private WAN address with "abuse". In that case send only myipv6 — or use the DNS Beacon client directly on the target device, which detects both address families itself.

Need a free hostname first?

Create a free DNS Beacon account, add a hostname and generate an API key — then come back and finish the setup above.

Create free account

Back to all setup guides