Is it possible to set up NTP Server using name address instead of IP address?

Hi, everyone.

Quick question: is there a way to set up NTP Server on RouterOS using name address instead of IP address?

Not sure what you mean.

At the NTP server settings there is really not a spot for name you just enable the service.
At the NTP client setting you can put in domain names or IPs for national or international ntp servers?

Ofcourse, You’re right - i was thinking about SNTP Client. What I want to know is how MikroTik stores server address. When i put address as domain name it is converted to IP address. What will happen when IP address for specified domain is changed?

You have to change it within the sntp configuration.
If it’s so important to you,
“create” your NTP server with the RouterOS add-on package and set all your clients to use that IP

It’s not that important. I’m new to MikroTik world and learn as I go. Untill now I was using mainly TP-LINK, where it’s possible to enter domain name and it won’t be converted to IP address. It’s weird though that RouterOS as advanced as it is doesn’t support it, since every time service website i visited says that “It is strongly recommended to use name instead of IP”.

If you work, and not just play for yourself, the right strategy is use your own nation official atomic clock ntp server, not to read advise on third websites.

No offence, but it looks like You know nothing on a subject. If You did, You would know that recommendation I mentioned before was from official sites. It’s on USA website as well as on PL, and i bet You could find it on other websites too.

some link to this websites (please on english if possible)?

I’m not offending, but you do not do my work, I’m a WISP, or you do your work on wrong way,
because if you lean on dns name of third party on tp-link device instead to set YOUR IP (or YOUR DNS like ntp.mycompanyname.net, is not that the point) inside and use YOUR OWN NTP Server, probably you just install AP for someone than be one ISP.

My choice:
ntp.mycompanyname.net → my primary NTP server
ntp1.mycompanyname.net → my primary NTP server
ntp2.mycompanyname.net → my secondary NTP server
nntp.mycompanyname.net → National primary NTP server
nntp1.mycompanyname.net → National primary NTP server
nntp2.mycompanyname.net → National secondary NTP server
I have everytime the contol on what are set on the devices inside my network, using IP or DNS no matter.
Also on DHCP Server I use that values passed to clients

In SNTP Client, you can use “Server DNS Names” to enter a domain name, like pool.ntp.org .

https://help.mikrotik.com/docs/pages/viewpage.action?pageId=40992869

Yes - 7.1beta6 feature.

Proof:
ntp-client.png

Also on RoS 6.48.3 and earlier
sntp.png

The problem with RouterOS version 6 is that when you install the optional NTP server package, it also replaces the SNTP client, and the new NTP client is much more limited… (only 2 server addresses, only as literal IP address and not as DNS name).
In RouterOS version 7 that problem is no longer present, as the server is now part of the standard install and the supplied client is much more flexible.
It can use several servers and they can be specified as IP address or DNS.

It is unfortunate that the development of RouterOS v7 is sooooooo slooooowwww… we get a new beta every couple of months and it is so far from production ready.
So you will have to live with this NTP limitation for some time.

With the NTP package you can create a timed script that resolves the host names and re-writes the IP addresses configured for NTP. A search will find examples. I had this one, but then I learned that with the build in client, it’s not needed anyway ..

{
:local ntpServer1 "0.uk.pool.ntp.org"
:local ntpServer2 "1.uk.pool.ntp.org"
:local primary [resolve $ntpServer1]
:local secondary [resolve $ntpServer2]

/system ntp client set enabled=yes primary-ntp=$primary secondary-ntp=$secondary
}

Why complicate things…

/system ntp client
set primary-ntp=[:resolve "0.pool.ntp.org"] secondary-ntp=[:resolve "1.pool.ntp.org"]

https://www.pool.ntp.org/zone

That works with the built-in SNTP client, but (as I understand it) not with the add-on NTP package. Or not until RoS 7. As noted in the post before mine.

“Why complicate things…”
is for short 5 commands on only clear one…


This command are identical for both default (s)NTP and with NTP package installed on 6.46.8+ versions, I do not know if it work on 7.+

Not a problem:
https://nrc.canada.ca/en/certifications-evaluations-standards/canadas-official-time/network-time-protocol-ntp
https://tf.nist.gov/tf-cgi/servers.cgi

Thanks

Sorry I think I misunderstood - you mean simplify the script, I thought you meant it could be done without the script.

I have noticed :stuck_out_tongue: