Hi,
this solution is for newbies as me. I used GUI and CLI.
So, I looked at the examples from Mikrotik’s wiki page,
especially at the “Alternative script”:
https://wiki.mikrotik.com/wiki/Dynamic_DNS_Update_Script_for_No-IP_DNS
A little bit older (mine’s RouterOS v6.47.4 (stable)).
The main problems:
- for some reasons the script didn’t work
(no IP refreshing, nothing appeared in logs);
- at first sight, no HTTPS requests.
So (without knowing a bit about Mikrotik’s scripting) I started to
“debug” the Alternative script (which is a great one), line by line.
First of all: don’t use special characters as $ in your passwords, unless
you know how to use escaping characters (I didn’t). Second, typos…
Then I looked at “Request methods” in noip’s page:
https://www.noip.com/integrate/request
The last thing: it’s working/not ? Let’s try it manually:
I entered in the router’s GUI, on WebFig, then I clicked
to Terminal (you may try also Putty, SSH):
[admin@Mikrotik] > /tool fetch mode=https user=“myuser@xxx.yyy” password=“my_password” url=“https://dynupdate.no-ip.com/nic/update\3Fhostname=my_domain.ddns.net&myip=xxx.xxx.xxx.xxx” keep-result=no
status: finished
downloaded: 0KiBC-z pause]
total: 0KiB
duration: 0s
It’s working (https too) !
Of course, you have to replace user, password, hostname and myip with yours.
Pinging my_domain.ddns.net will see the new IP after a couple of seconds/minutes.
- So, in the router’s GUI, on WebFig, Menu: System, Scripts >> Add New:
Name [no-ip_ddns_update]
Owner (your user, autocompleted)
Policy read write test
Source # put here the code (see below):
Comment [noip_ddns]
After putting the code into the Source field, click “Apply”.
If there are no typos, “not invalid” should appear below,
so click then on “OK” too.
Don’t forget to replace “myuser@xxx.yyy”, “my_password”,
and “my_domain.ddns.net” with your credentials & domain.
#######################################################
The code
#######################################################
:local Mywan “pppoe-out1”
:local NOIPUser “myuser@xxx.yyy”
:local NOIPPass “my_password”
:local NOIPDomain “my_domain.ddns.net”
:local NOIPhttp “https://dynupdate.no-ip.com/nic/update”
:local IpCurrentMe [/ip address get [find interface=$Mywan] address];
:local IpCurrentNoip [:put [:resolve $NOIPDomain]];
:for i from=( [:len $IpCurrentMe] - 1) to=0 do={
:if ( [:pick $IpCurrentMe $i] = “/”) do={
:local NewIP [:pick $IpCurrentMe 0 $i];
:if ($IpCurrentNoip != $NewIP) do={
/tool fetch mode=https user=$NOIPUser password=$NOIPPass url=“$NOIPhttp\3Fhostname=$NOIPDomain&myip=$NewIP” keep-result=no
:log info “NO-IP Update: $NOIPDomain - $NewIP”
}
}
}
#######################################################
- The scheduler entry - to run the above task at every 5 minutes (similar to cron):
CLI: go to the router’s GUI, on WebFig, then click to Terminal (or use Putty) and enter:
/system script add name=no-ip_ddns_update policy=write,read,test source=“”
2.1 The scheduler’s entries may be seen on GUI too, on WebFig, Menu >> Scheduler.
2.2 If you’ll like to add the entry from GUI, just click on Add New (in the Scheduler section):
Name [no-ip_ddns_update]
Start Date [Oct/07/2020] (for example)
Start Time [12:46:29] (for example)
Interval [00:05:00]
Owner (your user, autocompleted)
Policy read write test
Run Count (xx, autocompleted)
Next Run (Oct/08/2020 09:21:29, for example, autocompleted)
On Event [no-ip_ddns_update]
Comment [Update No-IP DDNS]
check Enabled
click “Apply” then “OK”.
- Disconnect and then reconnect PPPoE after 30 seconds to check if a new IP appears.
Also ping my_domain.ddns.net (replace “my_domain” with your hostname from noip).
If you get a new IP and your script ran correctly, you should see that in your Mikrotik’s logs.
3.1 In GUI, on WebFig, Menu, Log
3.2 In CLI, you should see something similar:
[admin@Mikrotik] > /log print
00:46:12 system,info router rebooted
00:46:13 pppoe,ppp,info pppoe-out1: initializing…
00:46:13 pppoe,ppp,info pppoe-out1: waiting for packets…
…
00:46:21 pppoe,ppp,info pppoe-out1: connecting…
00:46:22 interface,info ether1 link up (speed 1G, full duplex)
00:46:27 pppoe,ppp,info pppoe-out1: authenticated
00:46:27 pppoe,ppp,info pppoe-out1: connected
00:46:30 script,info NO-IP Update: my_domain.ddns.net - xxx.xxx.xxx.xxx
That’s it.



