Manual:System/Time: Difference between revisions

From MikroTik Wiki
Jump to navigation Jump to search
mNo edit summary
(Convert to wiki markup)
Line 1: Line 1:
<div class=manual>
==Clock and Time zone configuration==


<h2>Clock and Time zone configuration</h2>
RouterOS uses data from the [http://www.twinsun.com/tz/tz-link.htm 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.


Following settings are available in the '''/system clock''' console path, and in the "Time" tab of the "System &gt; Clock" WinBox window:


<p>RouterOS uses data from the [http://www.twinsun.com/tz/tz-link.htm tz database],  
* '''time''' (''HH:MM:SS'', where ''HH'' - hour 00..24, ''MM'' - minutes 00..59, ''SS'' - seconds 00..59)
Most of the time zones from this database are included, and have the same names.
* '''date''' (''mmm/DD/YYYY'', where ''mmm'' - month, one of ''jan'', ''feb'', ''mar'', ''apr'', ''may'', ''jun'', ''jul'', ''aug'', ''sep'', ''oct'', ''nov'', ''dec'', ''DD'' - date, 00..31, ''YYYY'' - year, 1970..2037) : '''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.
<br>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.</p>
* '''time-zone-name''' (''manual'', or name of time zone; default value: ''manual'') : Name of time zone. Like most of the text values in RouterOS, this value is case sensitive. Special value ''manual'' applies [[#Manual time zone configuration|manually configured GMT offset]], which by default is ''00:00'' with no daylight saving time.


===Active time zone information===


<div class=properties>
* '''dst-active''' (''yes'' or ''no''>; read-only property) : This property has value ''yes'' while daylight saving time of the current time zone is active.
<h4>Configuration</h4>
* '''gmt-offset''' ([''+''|''-'']''HH:MM'' - offset in hours and minutes; read-only property) : This is the current value of GMT offset used by the system, after applying base time zone offset and active daylight saving time offset.
<p>These settings are available in the <code>/system clock</code> console path, and in the "Time" tab of the "System &gt; Clock" WinBox window</p>


<p><h5><var>time</var></h5> (<i><em>HH</em>:<em>MM</em>:<em>SS</em></i>, where <i><em>HH</em></i> - hour <i>00</i>..<i>24</i>, <i><em>MM</em></i> - minutes <i>00</i>..<i>59</i>, <i><em>SS</em></i> - seconds <i>00</i>..<i>59</i>)
===Manual time zone configuration===
<br><h5><var>date</var></h5> (<i><em>mmm</em>/<em>DD</em>/<em>YYYY</em></i>, where <i><em>mmm</em></i> - month, one of <i>jan</i>, <i>feb</i>, <i>mar</i>, <i>apr</i>, <i>may</i>, <i>jun</i>, <i>jul</i>, <i>aug</i>, <i>sep</i>, <i>oct</i>, <i>nov</i>, <i>dec</i>, <i><em>DDM</em></i> - date, <i>00</i>..<i>31</i>, <i><em>YYYY</em></i> - year, <i>1970</i>..<i>2037</i>) &mdash; <var>date</var> and <var>time</var> show current local time on the router. These values can be adjusted using the <code>set</code> command. Local time cannot, however, be exported, and is not stored with the rest of  the configuration.</p>
These settings are available in '''/system clock manual''' console path, and in the "Manual Time Zone" tab of the "System &gt; 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.


<p><h5><var>time-zone-name</var></h5> (<i>manual</i>, or name of time zone; default value: <i>manual</i>) &mdash; Name of time zone. Like most of the text values in RouterOS, this value is case sensitive. Special value <i>manual</i> applies [[#Manual time zone configuration|manually configured GMT offset]], which by default is <i>00:00</i>, with no daylight saving time.</p>
* '''time-zone''', '''dst-delta''' ([''+''|''-'']''HH:MM'' - time offset in hours and minutes, leading plus sign is optional; default value: ''+00:00'') : 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''' (''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'') : Local time when DST starts and ends.


<h4>Active time zone information</h4>
==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.


<p><h5><var>dst-active</var></h5> (<i>yes</i> or <i>no</i>; read-only property) &mdash; This property has value <i>yes</i> while daylight saving time of the current time zone is active.</p>
Client configuration is located in the '''/system ntp client''' console path, and the "System &gt; 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.


<p><h5><var>gmt-offset</var></h5> ([<i>+</i>|<i>-</i>]<i><em>HH</em>:<em>MM</em></i> (offset in hours and minutes); read-only property) &mdash; This is the current value of GMT offset used by the system, after applying base time zone offset and active daylight saving time offset.</p>
* '''enabled''' (''yes'' or ''no''; default value: ''no'')   
* '''mode''' (One of ''broadcast'' or ''unicast''; default value: ''broadcast'') : 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''' (IP address) : 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.


</div>
===Status===


<h4>Manual time zone configuration</h4>
* '''active-server''' (IP address; read-only property) : Currently selected NTP server address. This value is equal to '''primary-ntp''' or '''secondary-ntp'''.
<p>These settings are available in <code>/system clock manual</code> console path, and in the "Manual Time Zone" tab of the "System &gt; Clock" WinBox window.
* '''poll-interval''' (Time interval; read-only property) : Current iterval between requests sent to the active server. Initial value is 16 seconds, and it is increased by doubling to 15 minutes.
<br>These settings have effect only when <var>time-zone-name</var>=<i>manual</i>. It is only possible to manually configure single daylight saving time period.</p>


<div class=properties>
===Last received packet information===
<p><h5><var>time-zone</var></h5>, <h5><var>dst-delta</var></h5> ([<i>+</i>|<i>-</i>]<i><em>HH</em>:<em>MM</em></i> (time offset in hours and minutes, leading plus sign is optional); default value: <i>+00:00</i>) &mdash; While DST is not active use GMT offset <var>time-zone</var>. While DST is active use GMT offset <var>time-zone</var> + <var>dst-delta</var>.</p>
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.


<p><h5><var>dst-start</var></h5>, <h5><var>dst-end</var></h5> (<i><em>mmm</em>/<em>DD</em>/<em>YYYY</em> <em>HH</em>:<em>MM</em>:<em>SS</em></i> (date and time, either date or time can be ommited in the <code>set</code> command); default value: <i>jan/01/1970 00:00:00</i>) &mdash; <em>Local</em> time when DST starts and ends.</p>
* '''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 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.


</div>
===Log messages===
SNTP client can produce the following log messages. See article "[[logging]]" on how to set up logging and how to inspect logs.


<h2>SNTP client</h2>
* '''ntp''','''debug''' gradually adjust by ''OFFS''
<p>SNTP client is included in the <i>system</i> package. RouterOS implements SNTP protocol defined in RFC4330. Manycast mode is not supported. Full NTP client and server is included in the separate <i>ntp</i> package, that is not installed by default.</p>
* '''ntp''','''debug''' instantly adjust by <em>OFFS</em>
* '''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.


<div class=properties>
==NTP client and server==
<h4>Settings</h4>
To use NTP client and server, ''ntp'' package must be [[Packages|installed and enabled]].
<p>Client configuration is located in the <code>/system ntp client</code> console path, and the "System &gt; NTP Client" WinBox window. This configuration is shared by the SNTP client implementation in the <i>system</i> package and the NTP client implementation in the <i>ntp</i> package. When <i>ntp</i> package is installed and enabled, the SNTP client is disabled automatically.</p>


<p><h5><var>enabled</var></h5> (<i>yes</i> or <i>no</i>; default value: <i>no</i>)</p>
===Client settings===
   
Client configuration is located in '''/system ntp client'''.
<p><h5><var>mode</var></h5> (One of <i>broadcast</i> or <i>unicast</i>; default value: <i>broadcast</i>) &mdash; 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.</p>
* '''enabled''' (''yes'' or ''no''; default value: ''no'')
* '''mode''' (One of ''broadcast'', ''unicast'', ''multicast'' or ''manycast''.)
* '''primary-ntp''', '''secondary-ntp''' (IP address)


<p><h5><var>primary-ntp</var></h5>, <h5><var>secondary-ntp</var></h5> (IP address) &mdash; IP addresses of the NTP servers. These properties have effect only when <var>mode</var>=<i>unicast</i>. Value <i>0.0.0.0</i> is ignored. If both values are zero and <var>mode</var> is <i>unicast</i> 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.</p>
<h4>Status</h4>
<p><h5><var>active-server</var></h5> (IP address; read-only property) &mdash; Currently selected NTP server address. This value is equal to <var>primary-ntp</var> or <var>secondary-ntp</var>.</p>
<p><h5><var>poll-interval</var></h5> (Time interval; read-only property) &mdash; Current iterval between requests sent to the active server. Initial value is 16 seconds, and it is increased by doubling to 15 minutes.</p>
<h4>Last received packet information</h4>
<p>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.</p>
<p><h5><var>last-update-from</var></h5> (IP address; read-only property) &mdash; Source IP address of the last received NTP server packed that was successfully processed.</p>
<p><h5><var>last-update-before</var></h5> (Time interval; read-only property) &mdash; Time since the last successfully received server message.</p>
<p><h5><var>last-adjustment</var></h5> (Time interval; read-only property) &mdash; Amount of clock adjustment that was calculated from the last successfully received NTP server message.</p>
<p><h5><var>last-bad-packet-from</var></h5> (IP address; read-only property) &mdash; 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.</p>
<p><h5><var>last-bad-packet-before</var></h5> (Time interval; read-only property) &mdash; Time since the last receive failure.</p>
<p><h5><var>last-bad-packet-reason</var></h5> (Text; read-only property) &mdash; Text that describes reason of the last receive failure. Possible values are:<ul>
    <li><i>bad-packet-length</i> - Packet length is not in the acceptable range.
    <li><i>server-not-synchronized</i> - Leap Indicator field is set to "alarm condition" value, which means that clock on the server has not been synchronized yet.
    <li><i>zero-transmit-timestamp</i> - Transmit Timestamp field value is 0.
    <li><i>bad-mode</i> - Value of the Mode field is neither 'server' nor 'broadcast'.
    <li><i>kod-<em>ABCD</em></i> - Received "KoD" (Kiss-o'-Death) response. <em>ABCD</em> is the short "kiss code" text from the Reference Identifier field.
    <li><i>broadcast</i> - Received proadcast message, but <var>mode</var>=<i>unicast</i>.
    <li><i>non-broadcast</i> - Received packed was server reply, but <var>mode</var>=<i>broadcast</i>.
    <li><i>server-ip-mismatch</i> - Received response from address that is not <var>active-server</var>.
    <li><i>originate-timestamp-mismatch</i> - Originate Timestamp field in the server response message is not the same as the one included in the last request.
    <li><i>roundtrip-too-long</i> - request/response roundtrip exceeded 1 second.
</ul></p></div>
<h4>Log messages</h4>
<div class=logs>{{LogsLegend}}
<p>SNTP client can produce the following log messages. <small>(See article "[[logging]]" on how to set up logging and how to inspect logs.)</small>
<ul>
    <li><b>ntp</b>,<b>debug</b> gradually adjust by <em>OFFS</em>
    <li><b>ntp</b>,<b>debug</b> instantly adjust by <em>OFFS</em>
    <li><b>ntp</b>,<b>debug</b> Wait for <em>N</em> seconds before sending next message
    <li><b>ntp</b>,<b>debug</b> Wait for <em>N</em> seconds before restarting
    <li><b>ntp</b>,<b>debug</b>,<b>packet</b> packet receive error, restarting
    <li><b>ntp</b>,<b>debug</b>,<b>packet</b> received <em>PKT</em>
    <li><b>ntp</b>,<b>debug</b>,<b>packet</b> ignoring received <em>PKT</em>
    <li><b>ntp</b>,<b>debug</b>,<b>packet</b> error sending to <em>IP</em>, restarting
    <li><b>ntp</b>,<b>debug</b>,<b>packet</b> sending to <em>IP</em> <em>PKT</em>
</ul></p>
<p>Explanation of log message fields<ul>
    <li><em>OFFS</em> - difference of two NTP timestamp values, in hexadecimal.
    <li><em>PKT</em> - 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.
    <li><em>IP</em> - remote IP address.
</ul></p>
</div>
<h2>NTP client and server</h2>{{...}}
<p>To use NTP client and server, <i>ntp</i> package must be [[Packages|installed and enabled]].</p>
<div class=properties>
<h4>Client settings</h4>
<p>Client configuration is located in <code>/system ntp client</code>.</p>
<p><h5><var>enabled</var></h5> (<i>yes</i> or <i>no</i>; default value: <i>no</i>)</p>
<p><h5><var>mode</var></h5> (One of <i>broadcast</i>, <i>unicast</i>, <i>multicast</i> or <i>manycast</i>.)</p>
<p><h5><var>primary-ntp</var></h5>, <h5><var>secondary-ntp</var></h5> (IP address)</p>
</div>
</div>
[[Category:Manual]]
[[Category:Manual]]
[[Category:Unfinished]]

Revision as of 08:14, 29 September 2008

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.

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

  • time (HH:MM:SS, where HH - hour 00..24, MM - minutes 00..59, SS - seconds 00..59)
  • date (mmm/DD/YYYY, where mmm - month, one of jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec, DD - date, 00..31, YYYY - year, 1970..2037) : 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 (manual, or name of time zone; default value: manual) : 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 (yes or no>; read-only property) : This property has value yes while daylight saving time of the current time zone is active.
  • gmt-offset ([+|-]HH:MM - offset in hours and minutes; read-only property) : 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 ([+|-]HH:MM - time offset in hours and minutes, leading plus sign is optional; default value: +00:00) : 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 (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) : 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.

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 (yes or no; default value: no)
  • mode (One of broadcast or unicast; default value: broadcast) : 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 (IP address) : 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 (IP address; read-only property) : Currently selected NTP server address. This value is equal to primary-ntp or secondary-ntp.
  • poll-interval (Time interval; read-only property) : 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 (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 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

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

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

Client settings

Client configuration is located in /system ntp client.

  • enabled (yes or no; default value: no)
  • mode (One of broadcast, unicast, multicast or manycast.)
  • primary-ntp, secondary-ntp (IP address)