Manual:System/Time

From MikroTik Wiki
< Manual:System
Revision as of 13:24, 23 September 2008 by Eep (talk | contribs)
Jump to: navigation, search

Clock and Time zone configuration


RouterOS uses data from the tz database, Most of the time zones from this database are included, and have the same names.
Because local time on the router is used mostly for timestamping and time-dependant configuration, and not for historical date calculations, time zone information about past years is not included. Currently only information starting from 2005 is included.


Configuration

These settings are available in the /system clock console path, and in the "Time" tab of the "System > Clock" WinBox window

time

Syntax: HH:MM:SS

  • HH - hour 00..24
  • MM - minutes 00..59
  • SS - seconds 00..59

date

Syntax: mmm/DD/YYYY

  • mmm - month, one of jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
  • DDM - date, 00..31
  • YYYY - year, 1970..2037

Description: date and time show current local time on the router. These values can be adjusted using the set command. Local time cannot, however, be exported, and is not stored with the rest of the configuration.

time-zone-name

Syntax: manual, or name of time zone. Like most other text

Default value: manual

Description: Name of time zone. Like most of the text values in RouterOS, this value is case sensitive. Special value manual applies manually configured GMT offset, which by default is 00:00, with no daylight saving time.

Active time zone information

dst-active

Syntax: yes or no

Read-only property

Description: This property has value yes while daylight saving time of the current time zone is active.

gmt-offset

Syntax: [+|-]HH:MM (offset in hours and minutes)

Read-only property

Description: This is the current value of GMT offset used by the system, after applying base time zone offset and active daylight saving time offset.

Manual time zone configuration

These settings are available in /system clock manual console path, and in the "Manual Time Zone" tab of the "System > Clock" WinBox window.
These settings have effect only when time-zone-name=manual. It is only possible to manually configure single daylight saving time period.

time-zone
,
dst-delta

Syntax: [+|-]HH:MM (time offset in hours and minutes, leading plus sign is optional)

Default value: +00:00

Description: While DST is not active use GMT offset time-zone.
While DST is active use GMT offset time-zone + dst-delta.

dst-start
,
dst-end

Syntax: mmm/DD/YYYY HH:MM:SS (date and time, either date or time can be ommited in the set command)

Default value: jan/01/1970 00:00:00

Description: Local time when DST starts and ends.

SNTP client

SNTP client is included in the system package. RouterOS implements SNTP protocol defined in RFC4330. Manycast mode is not supported. Full NTP client and server is included in the separate ntp package, that is not installed by default.

Settings

Client configuration is located in the /system ntp client console path, and the "System > NTP Client" 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.

enabled

Syntax: yes or no

Default value: no

mode

Syntax: One of broadcast or unicast.

Default value: broadcast

Description: In broadcast mode, client does not send any requests, and listens for the broadcast messages sent by the NTP server. In unicast mode client periodically sends requests to the currently selected active server, and waits for a reply message from that server.

primary-ntp
,
secondary-ntp

Syntax: IP address

Description: IP addresses of the NTP servers. These properties have effect only when mode=unicast. Value 0.0.0.0 is ignored.

If both values are zero and mode is unicast then SNTP client is disabled. If both values are non-zero, then SNTP client will alternate between the two server addresses, switching to the other when request to the current server times out or when the "KoD" packet is received, indicating that server is not willing to respond to requiests from this client.

Status

active-server

Syntax: IP address

Read-only property

Description: Currently selected NTP server address. This value is equal to primary-ntp or secondary-ntp.

poll-interval

Syntax: Time interval

Read-only property

Description: Current iterval between requests sent to the active server. Initial value is 16 seconds, and it is increased by doubling to 15 minutes.

Last received packet information

Values of the following properties are reset when the SNTP client is stopped or restarted, either because of a configuration change, or because of a network error.

last-update-from

Syntax: IP address

Read-only property

Description: Source IP address of the last received NTP server packed that was successfully processed.

last-update-before

Syntax:

Read-only property

Description: Time since the last successfully received server message.

last-adjustment

Syntax: Time interval

Read-only property

Description: Amount of clock adjustment that was calculated from the last successfully received NTP server message.

last-bad-packet-from

Syntax: IP address

Read-only property

Description: 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

Syntax: Time interval

Read-only property

Description: Time since the last receive failure.

last-bad-packet-reason

Syntax: Text

Read-only property

Description: Text that describes 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.

Log messages

Explanation of different text styles used in log message listing:
  • aaa,bbb - topics associated with the log message
  • abc def - literal text of the log message
  • ABC - name of a variable field

SNTP client can produce the following log messages. (See article "logging" on how to set up logging and how to inspect logs.)

  • ntp,debug gradually adjust by OFFS
  • ntp,debug instantly adjust by OFFS
  • ntp,debug Wait for N seconds before sending next message
  • ntp,debug Wait for N seconds before restarting
  • ntp,debug,packet packet receive error, restarting
  • ntp,debug,packet received PKT
  • ntp,debug,packet ignoring received PKT
  • ntp,debug,packet error sending to IP, restarting
  • ntp,debug,packet sending to IP PKT

Explanation of log message fields

  • OFFS - difference of two NTP timestamp values, in hexadecimal.
  • PKT - dump of NTP packet. If packet is shorter than the minimum 48 bytes, it is dumped as a hexadecimal string. Otherwise, packet is dumped as a list of field names and values, one per log line. Names of fields follow RFC4330.
  • IP - remote IP address.

NTP client and server

(needs editing)

To use NTP client and server, ntp package must be installed and enabled.

Client settings

Client configuration is located in /system ntp client.

enabled

Syntax: yes or no

Default value: no

mode

Syntax: One of broadcast, unicast, multicast or manycast.

primary-ntp
,
secondary-ntp

Syntax: IP address