Time Synchronisation

NTP is a TCP/IP protocol for synchronising time over a network. Basically a client requests the current time from a server, and uses it to set its own clock.

Behind this simple description, there is a lot of complexity - there are tiers of NTP servers, with the tier one NTP servers connected to atomic clocks, and tier two and three servers spreading the load of actually handling requests across the Internet. Also the client software is a lot more complex than you might think - it has to factor out communication delays, and adjust the time in a way that does not upset all the other processes that run on the server. But luckily all that complexity is hidden from you!

Ubuntu by default uses timedatectl / timesyncd to synchronize time and users can optionally use ntpd to serve network time info.

Synchronizing your systems time

Starting with Ubuntu 16.04 timedatectl / timesyncd (which are part of systemd) replace most of ntpdate / ntp.

timesyncd is available by default and replaces not only ntpdate, but also the client portion of ntpd. So on top of the one-shot action that ntpdate provided on boot and network activation, now timesyncd by default regularly checks and keeps your local time in sync. It also stores time updates locally, so that after reboots monotonically advances if applicable.

If ntpdate / ntp are installed timedatectl steps back to let you keep your old setup. That shall ensure that no two time syncing services are fighting and also to retain any kind of old behaviour/config that you had through an upgrade. But it also implies that on an upgrade from a former release ntp/ntpdate might still be installed and therefore renders the new systemd based services disabled.

ntpdate is considered deprecated in favour of timedatectl and thereby no more installed by default.

Configuring timedatectl and timesyncd

The current status of time and time configuration via timedatectl and timesyncd can be checked with timedatectl status.

$ timedatectl status
      Local time: Mo 2017-06-26 12:16:16 CEST
  Universal time: Mo 2017-06-26 10:16:16 UTC
        RTC time: Mo 2017-06-26 10:16:16
       Time zone: Europe/Berlin (CEST, +0200)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

Via timedatectl an admin can control the timezone, how the system clock should relate to the hwclock and if permanent synronization should be enabled or not. See man timedatectl for more details.

timesyncd itself is still a normal service, so you can check its status also more in detail via.

$ systemctl status systemd-timesyncd
. systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
   Active: active (running) since Mo 2017-06-26 11:12:19 CEST; 30min ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 12379 (systemd-timesyn)
   Status: "Synchronized to time server [2001:67c:1560:8003::c8]:123 (ntp.ubuntu.com)."
    Tasks: 2
   Memory: 424.0K
      CPU: 12ms
   CGroup: /system.slice/systemd-timesyncd.service
           |_12379 /lib/systemd/systemd-timesyncd

Jun 26 11:12:19 lap systemd[1]: Starting Network Time Synchronization...
Jun 26 11:12:19 lap systemd[1]: Started Network Time Synchronization.
Jun 26 11:12:19 lap systemd-timesyncd[12379]: Synchronized to time server [2001:67c:1560:8003::c8]:123 (ntp.ubuntu.com).

The nameserver to fetch time for timedatectl and timesyncd from can be specified in /etc/systemd/timesyncd.conf and additional config files can be stored in /etc/systemd/timesyncd.conf.d/. The entries for NTP= and FallbackNTP= are space separated lists.

Serving NTP

If on top of synchronizing your system you also want to serve NTP information you need an ntp server. The most classic and supported one is ntpd, but it is also very old so there also are openntpd and chrony as alternatives available in the archive.


The ntp daemon ntpd calculates the drift of your system clock and continuously adjusts it, so there are no large corrections that could lead to inconsistent logs for instance. The cost is a little processing power and memory, but for a modern server this is negligible.


To install ntpd, from a terminal prompt enter:

sudo apt install ntp


Edit /etc/ntp.conf to add/remove server lines. By default these servers are configured:

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

After changing the config file you have to reload the ntpd:

sudo systemctl reload ntp.service

Of the pool number 2.ubuntu.pool.ntp.org as well as ntp.ubuntu.com also support ipv6 if needed. If one needs to force ipv6 there also is ipv6.ntp.ubuntu.com which is not configured by default.

View status

Use ntpq to see more info:

# sudo ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
+stratum2-2.NTP.    2 u    5   64  377   68.461  -44.274 110.334
+ntp2.m-online.n     2 u    5   64  377   54.629  -27.318  78.882
*  .DCFa.           1 u   10   64  377   83.607  -30.159  68.343
+stratum2-3.NTP.    2 u    5   64  357   68.795  -68.168 104.612
+europium.canoni    2 u   63   64  337   81.534  -67.968  92.792

PPS Support

Since 16.04 ntp supports PPS discipline which can be used to augment ntp with local timesources for better accuracy. For more details on configuration see the external pps ressource listed below.