Network Time Protocol (NTP)

Document revision 1.3 (04-Sep-2003)
This document applies to the MikroTik RouterOS V2.7

Table of Contents

Summary

NTP protocol allows synchronizing 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.html

Specifications

Packages required : ntp
License required : Any
Home menu level : /system ntp
Protocols utilized : NTP (RFC958)
Hardware usage: not significant

Related Documents

Software Package Installation and Upgrading
IP Addresses and Address Resolution Protocol (ARP)
Firewall Filters and Network Address Translation (NAT)

Description

Network Time Protocol (NTP) is used to synchronize time with some NTP servers in a network. MikroTik RouterOS privides both NTP client and NTP server.

NTP client synchronizes local clock with some other time source (NTP server). There are 4 modes in which NTP client can operate:

NTP Client

Submenu level : /system ntp client
[admin@MikroTik] > system ntp client print
	  enabled: no
	     mode: unicast
      primary-ntp: 0.0.0.0
    secondary-ntp: 0.0.0.0
	   status: stopped
[admin@MikroTik] >

Property Description

enabled (yes | no, default: no) - whether the NTP client is enabled
mode (unicast | broadcast | multicast | manycast, default: unicast) - NTP client mode
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

Statistics:

status (string) - status of NTP client:

  • stopped - NTP is not running (NTP is disabled)
  • error - there was some internal error starting NTP service. (please, try to restart (disable and enable) NTP service)
  • started - NTP client service is started, but NTP server is not found, yet
  • failed - NTP server sent invalid response to our NTP client. (NTP server is not synchronous to some other time source)
  • reached - NTP server contacted. Comparing local clock to NTP server's clock. (duration of this phase - approx 30 sec)
  • timeset - local time changed to NTP server's time. (duration of this phase - approx 30 sec)
  • synchronized - local clock is synchronized to NTP server's clock. NTP server is activated.
  • using-local-clock - using local clock as time source (server enabled while client disabled)

    Example

    To enable the NTP client to synchronize with the 159.148.60.2 server:
               status: reached
    [admin@MikroTik] system ntp client> print
              enabled: yes
                 mode: unicast
          primary-ntp: 159.148.60.2
        secondary-ntp: 0.0.0.0
               status: synchronized
    [admin@MikroTik] system ntp client>
    

    NTP Server

    Submenu level : /system ntp server
    [admin@MikroTik] > system ntp server print
          enabled: no
        broadcast: no
        multicast: no
         manycast: yes
    [admin@MikroTik] >
    

    Property Description

    enabled (yes | no, default: no) - whether the NTP client is enabled
    broadcast (yes | no, default: no) - whether NTP broadcast message is sent to 255.255.255.255 every 64s
    multicast (yes | no, default: no) - whether NTP multicast message is sent to 224.0.1.1 every 64s
    manycast (yes | no, default: yes) - whether NTP server listens for multicast messages sent to 239.192.1.1 and responds to them

    Notes

    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, all individual time requests are answered.

    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, it will be possible for this user to change time on Your server at his will.

    Example

    To enable NTP server to answer unicast requests only:
    [admin@MikroTik] system ntp client> .. server print
          enabled: yes
        broadcast: no
        multicast: no
         manycast: no
    [admin@MikroTik] system ntp client>
    

    Time Zone

    Submenu level : /system clock
    [admin@MikroTik] > system clock print
    	 time: aug/12/2002 18:31:20
        time-zone: +00:00
    [admin@MikroTik] >
    
    Notes NTP changes local clock to UTC (GMT) time by default

    Example

    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:
    [admin@MikroTik] > system clock set time-zone=1
    [admin@MikroTik] > system clock print
    	 time: aug/12/2002 19:31:57
        time-zone: +01:00
    [admin@MikroTik] >
    
    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:
    [admin@MikroTik] > system clock set time-zone=-3
    [admin@MikroTik] > system clock print
    	 time: aug/12/2002 15:32:20
        time-zone: -03:00
    [admin@MikroTik] >
    


    © Copyright 1999-2003, MikroTik