Mikrotik dhcp ntp pool servers

Microtic devices have a huge range of functionalities, but there are various strange and inexplicable limitations, which can make you wonder for a long time “WHY?”. It is a similar restriction, that only IP addresses for NTP servers can be placed in the dhcp pool settings, to be distributed to customers but not hosts. If we want to use a server from ntp pool and to distribute it to customers behind microtics we have a serious problem – or we need to put IP addresses from the ntp pool project, as they are currently being resolved, but we have no guarantee, that they will continue to work for the future or we have to think of another scheme. I decided to be either…

The Microtic OS offers the ability to writing scripts. I can not say, that I am an expert there, but I don't mind using it, when i need. We will briefly create a script, which resolves 4 The NTP server and then configure our dhcp pool with them. The script is quite simple:

:local s0 [resolve bg.pool.ntp.org]
:local s1 [resolve bg.pool.ntp.org]
:local s2 [resolve bg.pool.ntp.org]
:local s3 [resolve bg.pool.ntp.org]

/ip dhcp-server network set ntp-server="$s0,$s1,$s2,$s3" numbers=0

Then all we have to do is make the script run once a week, say – at least for me this is a very reasonable period and that, that I have 4 the NTP address is safe enough even if one of them stops working:

/system scheduler
add interval=1w name=ntpSet policy=\
    read,write,policy \
    start-date=nov/02/2020 start-time=20:17:14

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti SPAM *