10

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.

4
  • In my /etc/default/ntpdate there is a warning that the file is not actually used, but that /etc/ntp.conf is used instead. There are various time servers mentioned in /etc/ntp.conf, did you try changing that?
    – Jos
    Nov 3 '16 at 7:42
  • what was the question before 12.04 ?
    – Anwar
    Nov 3 '16 at 7:57
  • @Jos: neither of those exist for me on a fresh install of 16.04 LTS (installed in VMware player.)
    – PaulBags
    Nov 3 '16 at 8:34
  • @Anwar: link
    – PaulBags
    Nov 3 '16 at 8:34
6

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/.

1
  • 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 3 '16 at 8:45
10

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
2
  • 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. 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 ? Nov 14 '20 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.