set_ntp_servers
Set the NTP servers a MikroTik device uses to sync its clock. Call with confirm=False for a before/after preview, then confirm=True to apply the server list to the device.
Instructions
Set the NTP server(s) a device syncs its clock against
(/system/ntp/client). servers is a list of one or more IPv4/
IPv6 addresses or hostnames.
WRITE tool, guarded: blocked entirely unless the server is running
with MIKROTIK_ALLOW_WRITE=true. Call with confirm=False (the
default) to get a before/after preview without changing anything;
call again with confirm=True to actually apply it. Never
enables/disables the NTP client itself - only the server list
changes; the returned preview's warning says so if the client is
currently disabled.
Works against either RouterOS generation, detected by reading
/system/ntp/client first: ROS7 writes the full servers list;
ROS6 has no such list - servers[0]/servers[1] map onto its fixed
primary-ntp/secondary-ntp slots instead (extras beyond two are
dropped, called out in warning). A hostname destined for one of
those two ROS6 slots is folded into server-dns-names if the device
has that field, otherwise it is not applied - warning says so. See
guard.set_ntp_servers's docstring for the full detection/mapping
rules.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No | ||
| servers | Yes | ||
| device_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||