MikroTik RouterOS V2.5 Network Time Protocol

Document revision 25-Nov-2001
This document applies to the MikroTik RouterOS V2.5

Overview

NTP protocol allows to synchronize time among computers in network. The best is if there is internet connection available and local NTP server is synchronized to correct time source. List of public NTP servers is available: http://www.eecis.udel.edu/~mills/ntp/servers.htm

Contents of the Manual

The following topics are covered in this manual:

NTP Client

The NTP Client setup is under /system ntp client

[MikroTik] system ntp client> print 
               status: stopped
              enabled: no
                 mode: unicast
           ntp-server: 0.0.0.0
    second-ntp-server: 0.0.0.0

NTP client synchronizes local clock to some other time source (NTP server). There are 4 modes in which NTP client can operate: unicast, broadcast, multicast and manycast.

In unicast (Client/Server) mode NTP client connects to specifed 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. Unicast mode is the only one which uses ntp-server and second-ntp-server parameters.

In broadcast mode NTP client listens for broadcast messages sent by NTP server. After receiving first broadcast message, client synchronizes local clock using unicast mode, and afterwards does not send any packets to that NTP server. It uses received broadcast messages to adjust local clock.

Multicast mode acts the same as broadcast mode, only instead of broadcast messages (IP address 255.255.255.255) multicast messages are sent (IP address 224.0.1.1).

Manycast mode actually is unicast mode only with unknown IP address of NTP server. To discover NTP server, client sends multicast message (IP 239.192.1.1). If NTP server is configured to listen for these multicast messages (manycast mode is enabled), it replies. After client receives reply, it enters unicast mode and synchronizes to that NTP server. But in parallel client continues to look for more NTP servers by sending multicast messages periodically.

Status of NTP client can be monitored by looking at status parameter. There are several possible statuses:

NTP Server

The NTP Server setup is under /system ntp server

[MikroTik] system ntp server> print 
      enabled: no
    broadcast: no
    multicast: no
     manycast: yes

(!) NTP server activates only when local NTP client is in synchronized or using-local-clock mode.

If NTP server is disabled, all NTP requests are ignored.

If NTP server is enabled and (!), all individual time requests are answered.

If broadcast is enabled and (!), NTP broadcast message is sent to 255.255.255.255 every 64s.

If multicast is enabled and (!), NTP multicast message is sent to 224.0.1.1 every 64s.

If manycast is enabled and (!), NTP server listens for multicast messages sent to 239.192.1.1 and responds to them.

CAUTION! Using broadcast, multicast and manycast modes is dangerous! Intruder (or simple user) can set up his own NTP server. If this new server will be chosen as time source for Your server, this user can change time on Your server at his will. Authentication is strongly suggested in these modes, but it is not implemented. It is possible (but not easy) to implement it (in case MikroTik users need authentication).

TIMEZONE

NTP changes local clock to UTC (GMT) time by default. To specify different time zone, time-zone parameter under "/system clock" has to be changed.

[MikroTik] system clock> print 
         time: nov/08/2001 17:33:42
    time-zone: 0s

Time zone is specified as a difference between local time and GMT time. For example, if GMT time is 18:00:00, but correct local time is 19:00:00, then time-zone has to be set to +1 hour:

[MikroTik] system clock> set time-zone=1h 
[MikroTik] system clock> print 
         time: nov/08/2001 18:36:53
    time-zone: 1h

If local time is before GMT time, time-zone value will be negative. For example, if GMT is 18:00:00, but correct local time is 15:00:00, time-zone has to be set to -3 hours:

[MikroTik] system clock> set time-zone=-3h 
[MikroTik] system clock> print 
         time: nov/08/2001 14:39:18
    time-zone: -3h


© Copyright 1999-2001, MikroTik