System Clock and Simple SNTP Client

Document revision:.NaN (January 23, 2008, 14:30 GMT)
Applies to: V3.0

System Clock

Summary

System clock allows router to track current date and time.

Specifications

License required: Level1
Submenu level: /system clock

Property Description

date (text) - date in format "mm/DD/YYY"

gmt-offset (read-only: text) - UTC timezone in format "+HH:MM" or "-HH:MM"

time (time) - time in format "HH:MM:SS"

time-zone-name (text; default: manual) - name of the timezone (usually, identified by a major city or a country). UTC offset and DST information of the selected location is used
manual - UTC offset and DST activation is set manually

Notes

It is recommended that you reboot the router after time change to obviate the possible errors in time measurments and logging.

Date and time settings become permanent and effect BIOS settings.

If NTP update gives time shifted by 1 hour, although the time zone is set correctly, you may want to adjust the DST setting in /system clock manual menu.

Example

To view the current date and time settings:

[admin@Local] system clock> print
            time: 09:08:37
            date: nov/18/2007
  time-zone-name: "manual"
      gmt-offset: +00:00
[admin@Local] system clock>

To set the system date and time to EET:

[admin@Local] system clock> set date=nov/22/2022 time=11:10:21 time-zone-name=EET
[admin@Local] system clock> print
        time: 11:10:25
        date: nov/18/2007
  time-zone-name: "EET"
      gmt-offset: +02:00
[admin@Local] system clock>

Manual Time Zone Settings

Submenu level: /system clock manual

Description

Usually the time zone and associated DST activation/deactivation time is properly configured when the major nearby location is specified in the time-zone-name parameter. In most countries, a Daylight Saving Time regime is activated in spring and deactivated in autumn. This configuration menu provides UTC timezone and DST adjustment facility, to set and drift the timezone according to your local legislation and practice if it is not set correctly by selecting an appropriate time zone name.

Property Description

dst-delta (text; default: +01:00) - UTC timezone drift in format "+HH:MM" or "-HH:MM" to be added to the local timezone during DST period

dst-end (date time) - date and time when DST ends (when the delta is to be dropped).

dst-start (date time) - date and time when DST begins (when the delta is to be applied).

time-zone (text) - UTC offset of the desired time zone in format "+HH:MM" or "-HH:MM"

Example

For EET timezone and DST zonechange active from mar/27/2005 03:00:00 till oct/30/2005 03:00:00:

[admin@MikroTik] system clock> set time-zone-name=manual
[admin@MikroTik] system clock> manual set time-zone=+02:00 dst-delta=+01:00 \
\... dst-start="mar/27/2005 03:00:00" dst-end="oct/30/2005 03:00:00"
[admin@MikroTik] system clock> manual print
  time-zone: +02:00
  dst-delta: +01:00
  dst-start: mar/27/2005 03:00:00
    dst-end: oct/30/2005 03:00:00
[admin@MikroTik] system clock dst>
      

General Information

Specifications

Submenu level: /system ntp client
Standards and Technologies: SNTP version 4 (RFC 2030)

Description

NTP protocol allows synchronizing time among computers in network. It is good if there is an internet connection available and local NTP server is synchronized to correct time source. List of public NTP servers is available at http://www.eecis.udel.edu/~mills/ntp/servers.html. SNTP is a simplified version of NTP, compatible with virtually all internet NTP servers, but lacks somevery high precision internal algorithms (and thus have significantly lower requirements and smaller memory footprint). There is also a full NTP client and server implementation for RouterOS available in a separate package (ntp package is available for download from www.mikrotik.com) with higher system requirements and more features, but the small SNTP client included in the system package is sufficient in most cases. Note that the software included in the ntp uses the same configuration menu, so you cannot use both NTP and SNTP at the same time.

Property Description

active-server (read-only: IP address) - server, the client is communicating with (unicast only)

enabled (yes | no; default: no) - whether the SNTP client is enabled or not

last-adjustment (read-only: time) - last time adjustment delta (difference between the local clock state and the received time during the last update)

last-bad-packet-before (read-only: time) - time since the last unaccepted NTP message has been received

last-bad-packet-from (read-only: IP address) - server address, which sent the last unaccepted message

last-bad-packet-reason (read-only: text) - reason that states why has the last unaccepted message been discarded

last-update-before (read-only: time) - time past since the last clock update

last-update-from (read-only: IP address) - IP address of the3 server that sent last accepted message, that was used to adjust clock

mode (unicast | broadcast; default: broadcast) - NTP client mode
broadcast - NTP client listens for broadcast messages sent by any NTP server. After receiving first broadcast message, client synchronizes local clock using unicast mode, and afterwards does not send any packets to that particular NTP server, but rather waits for the next broadcast messages
unicast - NTP client connects to the specified NTP server. IP address of NTP server must be set in ntp-server and/or second-ntp-server parameters. At first client synchronizes to NTP server. Afterwards client periodically (64..1024s) sends time requests to NTP server

poll-interval (read-only: time) - current interval between messages sent to server (unicast only)

primary-ntp (IP address; default: 0.0.0.0) - specifies IP address of the primary NTP server

secondary-ntp (IP address; default: 0.0.0.0) - specifies IP address of the secondary NTP server

Notes

CAUTION! Using broadcast mode is dangerous! Intruder (or simple user) can set up his/her own NTP server. If this new server will be chosen as time source for your router, it will be possible for this user to change time on your router at his/her will.

Example

To enable the NTP client to synchronize with the 159.148.60.11 server:

[admin@MikroTik] system ntp client> set enabled=yes primary-ntp=159.148.60.2 \
\... mode=unicast
[admin@MikroTik] system ntp client> print
             enabled: yes
                mode: unicast
         primary-ntp: 159.148.60.11
       secondary-ntp: 0.0.0.0
       poll-interval: 8m32s
       active-server: 159.148.60.11
    last-update-from: 159.148.60.11
  last-update-before: 1m38s120ms
     last-adjustment: 2ms562us
[admin@MikroTik] system ntp client>