Ubuntu 18.04になって時計合わせがntpdateからsystemd-timesyncdに変わってたので設定した

まずは現状確認。

$ sudo systemctl -l status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-07-30 21:09:27 JST; 4h 4min ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 586 (systemd-timesyn)
   Status: "Idle."
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/systemd-timesyncd.service
           └─586 /lib/systemd/systemd-timesyncd

 7月 30 23:32:11 arianrhod systemd-timesyncd[586]: Timed out waiting for reply from 91.189.91.157:123 (ntp.ubuntu.com).
 7月 30 23:32:22 arianrhod systemd-timesyncd[586]: Timed out waiting for reply from 91.189.94.4:123 (ntp.ubuntu.com).
 7月 31 00:06:40 arianrhod systemd-timesyncd[586]: Timed out waiting for reply from 91.189.91.157:123 (ntp.ubuntu.com).
 7月 31 00:06:50 arianrhod systemd-timesyncd[586]: Timed out waiting for reply from 91.189.89.199:123 (ntp.ubuntu.com).
 7月 31 00:07:01 arianrhod systemd-timesyncd[586]: Timed out waiting for reply from 91.189.94.4:123 (ntp.ubuntu.com).
 7月 31 00:07:11 arianrhod systemd-timesyncd[586]: Timed out waiting for reply from 91.189.89.198:123 (ntp.ubuntu.com).
 7月 31 00:41:29 arianrhod systemd-timesyncd[586]: Timed out waiting for reply from 91.189.91.157:123 (ntp.ubuntu.com).
 7月 31 00:41:40 arianrhod systemd-timesyncd[586]: Timed out waiting for reply from 91.189.89.199:123 (ntp.ubuntu.com).
 7月 31 00:41:50 arianrhod systemd-timesyncd[586]: Timed out waiting for reply from 91.189.94.4:123 (ntp.ubuntu.com).
 7月 31 00:42:00 arianrhod systemd-timesyncd[586]: Timed out waiting for reply from 91.189.89.198:123 (ntp.ubuntu.com).

なんか外へ行こうとしてるな。
ま、設定してないんだから当然か。

それでは社内のNTPサーバを設定します。

$ sudo vi systemd/timesyncd.conf

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.

[Time]
NTP=192.168.1.200
#FallbackNTP=ntp.ubuntu.com
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048

$ sudo systemctl restart systemd-timesyncd

確認確認っと。

$ sudo systemctl -l status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-07-31 01:17:22 JST; 7h left
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 7288 (systemd-timesyn)
   Status: "Synchronized to time server 192.168.1.200:123 (192.168.1.200)."
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/systemd-timesyncd.service
           └─7288 /lib/systemd/systemd-timesyncd

 7月 31 01:17:22 arianrhod systemd[1]: Starting Network Time Synchronization...
 7月 31 01:17:22 arianrhod systemd[1]: Started Network Time Synchronization.
 7月 30 17:17:21 arianrhod systemd-timesyncd[7288]: Synchronized to time server 192.168.1.200:123 (192.168.1.200).

$ date
2018年  7月 30日 月曜日 17:17:33 JST

ちゃんと動きましたー。