11

I know there are instructions for installing full NTP, but I'd rather change the default server under the default implementation. This question has come up before for 12.04 LTS, however the answer there:

edit the value of NTPSERVERS in /etc/default/ntpdate

appears to be no longer valid.

PaulBags
  • 113

2 Answers2

13

Ubuntu 16.04 uses by default server ntp.ubuntu.com [reference].

To change the default server, edit the config file with an editor:

sudo vi /etc/systemd/timesyncd.conf

Uncomment the NPT= line and define the server you want to be used instead of default:

[Time]
NTP=some.ntp.server.com

To "audit" the time-synchronization events and verify the server that was contacted, use the following command:

cat /var/log/syslog | grep systemd-timesyncd
Tfb9
  • 681
  • 4
  • 13
  • 33
  • 3
    systemctl status systemd-timesyncd can also be used to "audit," see PaulBags comment on the accepted answer (I like yours better). And sudo systemctl restart systemd-timesyncd can be used to force a sync. – Ulrich Stern Aug 22 '19 at 18:49
  • Are ypou sure that this is proper way? Are you surethat config will be not ovverride after systemd-upgrade? Maybe better create conf file under /etc/systemd/timesyncd.conf.d/ntp.conf ? – Vsevolod Gromov Nov 14 '20 at 11:07
  • Would recommend using journalctl -fu systemd-timesyncd.service to view updates in real time to the time service. Or at least do a tail -f /var/log/syslog, cat does not update. – Dave Jan 13 '23 at 13:53
7

According to the official documentation at: https://help.ubuntu.com/lts/serverguide/NTP.html

The nameserver to fetch time for timedatectl and timesyncd from can be specified in /etc/systemd/timesyncd.conf and with flexible additional config files in /etc/systemd/timesyncd.conf.d/.

slowko
  • 942
  • Cheers :). I like to be thorough and check that these changes are actually taking place, the man pages for timesyncd gave me the command "systemctl status systemd-timesyncd.service" as an example; and that showed up the NTP server I'd assigned. – PaulBags Nov 03 '16 at 08:45