...
The client configuration is located in the /system ntp client console path, and the "System > SNTP Client" (RouterOS version 6), "System > NTP Client" (RouterOS version 7) WinBox window. This configuration is shared by the SNTP client implementation in the system package and the NTP client implementation in the ntp package. When ntp package is installed and enabled, the SNTP client is disabled automatically.
RouterOS version 6
SNTP Client properties:
Property | Description |
---|---|
enabled (yes, no default: no) | Enable SNTP client for time synchronization |
mode (broadcast, unicast, filed is read-only) | Mode that the SNTP client will operate in. If no NTP servers are configured broadcast mode will be used. If there is a dynamic or static NTP server IP address or FQDN used it will automatically switch to unicast mode. |
primary-ntp (IP address default: 0.0.0.0) | IP address of the NTP server that has to be used for time synchronization. If both values are non-zero, then the SNTP client will alternate between the two server addresses, switching to the other when the request to the current server times out or when the "KoD" packet is received, indicating that the server is not willing to respond to requests from this client. The following formats are accepted: - ipv4 |
secondary-ntp (IP address default: 0.0.0.0) | see primary-ntp |
server-dns-names (Comma separated domain name list default: ) | To set the NTP server using its domain name. The domain name will be resolved each time an NTP request is sent. Router has to have /ip dns configured. |
...
- last-update-from (IP address; read-only property) : Source IP address of the last received NTP server packed that was successfully processed.
- last-update-before (Time interval; read-only property) : Time since the last successfully received server message.
- last-adjustment (Time interval; read-only property) : Amount of clock adjustment that was calculated from the last successfully received NTP server message.
- last-bad-packet-from (IP address; read-only property) : Source IP address of last received SNTP packed that was not successfully processed. Reason of the failure and time since this packet was received is available in the next two properties.
- last-bad-packet-before (Time interval; read-only property) : Time since the last receive failure.
- last-bad-packet-reason (Text; read-only property) : Text that describes the reason of the last receive failure. Possible values are:
- bad-packet-length - Packet length is not in the acceptable range.
- server-not-synchronized - Leap Indicator field is set to "alarm condition" value, which means that clock on the server has not been synchronized yet.
- zero-transmit-timestamp - Transmit Timestamp field value is 0.
- bad-mode - Value of the Mode field is neither 'server' nor 'broadcast'.
- kod-ABCD - Received "KoD" (Kiss-o'-Death) response. ABCD is the short "kiss code" text from the Reference Identifier field.
- broadcast - Received proadcast message, but mode=unicast.
- non-broadcast - Received packed was server reply, but mode=broadcast.
- server-ip-mismatch - Received response from address that is not active-server.
- originate-timestamp-mismatch - Originate Timestamp field in the server response message is not the same as the one included in the last request.
- roundtrip-too-long - request/response roundtrip exceeded 1 second.
Client settings example:
To check the status of the NTP client in CLI, use the "print" command
...
Code Block | ||
---|---|---|
| ||
[admin@ntp-example_v6] > /system ntp client set enabled=yes [admin@ntp-example_v6] > /system ntp client print enabled: yes primary-ntp: 0.0.0.0 secondary-ntp: 0.0.0.0 server-dns-names: mode: unicast dynamic-servers: x.x.x.x, x.x.x.x poll-interval: 15s active-server: x.x.x.x last-update-from: x.x.x.x last-update-before: 6s570ms last-adjustment: -1ms786us [admin@ntp-example_v6] > /system ntp client set primary-ntp=162.159.200.123 [admin@ntp-example_v6] > /system ntp client print enabled: yes primary-ntp: 162.159.200.123 secondary-ntp: 0.0.0.0 server-dns-names: mode: unicast dynamic-servers: x.x.x.x, x.x.x.x poll-interval: 16s active-server: x.x.x.x |
NTP Server settings:
Server configuration is located in /system ntp server
...
Code Block | ||
---|---|---|
| ||
/system ntp server set broadcast=yes broadcast-addresses=192.168.88.255 enabled=yes manycast=no |
RouterOS version 7
NTP Client properties:
Property | Description | |||||
---|---|---|---|---|---|---|
enabled (yes, no default: no) | Enable NTP client for time synchronization | |||||
mode (broadcast, manycast, multicast, unicast) | Mode that the NTP client will operate in | |||||
NTP servers | The list of NTP servers. It is possible to add static entries. The following formats are accepted: - FQDN ("Resolved Address" will appear in the "Servers"- window in an appropriate column if the address is resolved) or IP address can be used. If DHCP-Client property use-peer-ntp=yes - the dynamic entries advertised by DHCP | |||||
vrf (default: main) | Virtual Routing and Forwarding | |||||
Servers (Button/Section) | A detailed table of dynamically and statically added NTP servers (Address, Resolved address, Min Poll, Max Poll, iBurst, Auth. Key) To set the NTP server using its FQDN. The domain name will be resolved each time an NTP request is sent. Router has to have /ip/dns configured. | |||||
Peers | Current parameter values
| |||||
Keys | NTP symmetric keys, used for authentication between the NTP client and server. Key Identifier (Key ID) - an integer identifying the cryptographic key used to generate the message-authentication code. |
...
- synchronized, stopped, waiting, using-local-clock - Current status of the NTP client
- Frequency drift - The fractional frequency drift per unit time.
- synced-server - The IP address of the NTP Server.
- synced-stratum - The accuracy of each server is defined by a number called the stratum, with the topmost level (primary servers) assigned as one and each level downwards (secondary servers) in the hierarchy assigned as one greater than the preceding level.
- system-offset - This is a signed, fixed-point number indicating the offset of the NTP server's clock relative to the local clock, in seconds.
NTP Server settings:
Server configuration is located in /system ntp server
Property | Description |
---|---|
enabled(yes or no; default value: no) | Enable NTP server |
broadcast (yes or no; default value: no) | Enable certain NTP server mode, for this mode to work you have to set up broadcast-addresses field |
multicast (yes or no; default value: no) | Enable certain NTP server mode |
manycast (yes or no; default value: no) | Enable certain NTP server mode |
broadcast-addresses (IP address; default value: ) | Set broadcast address to use for NTP server broadcast mode |
vrf (default: main) | Virtual Routing and Forwarding |
use-local-clock (yes or no; default value: no) | The server will supply its local system time as valid if others are not available. |
local-clock-stratum | Manually set stratum if use-local-clock=yes |
auth-key (default value: none) | NTP symmetric key, used for authentication between the NTP client and server. Key Identifier (Key ID) - an integer identifying the cryptographic key used to generate the message-authentication code. |
Log messages
SNTP client can produce the following log messages. See the article "log" on how to set up logging and how to inspect logs.
...