PG1X WIKI

My Knowledge Base

User Tools

Site Tools


tech:server:linux:ubuntu:ntp:chrony:chrony

Configure Chrony NTP Server on Ubuntu Server 18.04 LTS

apt install chrony
/etc/chrony/chrony.conf
server ntp.nict.jp iburst
server ntp1.jst.mfeed.ad.jp iburst
server ntp2.jst.mfeed.ad.jp iburst
server ntp3.jst.mfeed.ad.jp iburst
server ntp1.v6.mfeed.ad.jp iburst
server ntp2.v6.mfeed.ad.jp iburst
server ntp3.v6.mfeed.ad.jp iburst
 
allow 10.0.8.0/22
sudo systemctl restart chrony
sudo systemctl status chrony
root@kozue:~# sudo systemctl restart chrony
root@kozue:~# sudo systemctl status chrony
● chrony.service - chrony, an NTP client/server
   Loaded: loaded (/lib/systemd/system/chrony.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2019-08-14 11:34:50 JST; 6s ago
     Docs: man:chronyd(8)
           man:chronyc(1)
           man:chrony.conf(5)
  Process: 3139 ExecStartPost=/usr/lib/chrony/chrony-helper update-daemon (code=exited, status=0/SUCCESS)
  Process: 3114 ExecStart=/usr/lib/systemd/scripts/chronyd-starter.sh $DAEMON_OPTS (code=exited, status=0/SUCCESS)
 Main PID: 3137 (chronyd)
    Tasks: 1 (limit: 4285)
   CGroup: /system.slice/chrony.service
           └─3137 /usr/sbin/chronyd

Aug 14 11:34:50 kozue systemd[1]: Starting chrony, an NTP client/server...
Aug 14 11:34:50 kozue chronyd[3137]: chronyd version 3.2 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SECHASH +SIGND +ASYNCDNS +IPV6 -DEBUG)
Aug 14 11:34:50 kozue chronyd[3137]: Frequency -3.570 +/- 3.047 ppm read from /var/lib/chrony/chrony.drift
Aug 14 11:34:50 kozue systemd[1]: Started chrony, an NTP client/server.
Aug 14 11:34:56 kozue chronyd[3137]: Selected source 2001:df0:232:eea0::fff4
Aug 14 11:34:56 kozue chronyd[3137]: Selected source 210.173.160.57
sudo chronyc sources
root@kozue:~# sudo chronyc sources
210 Number of sources = 7
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^- ntp-a3.nict.go.jp             1   6    17    51    -24ms[  -24ms] +/-   27ms
^+ ntp1.jst.mfeed.ad.jp          2   6    17    52  -1057us[-1057us] +/-   81ms
^* ntp2.jst.mfeed.ad.jp          2   6    17    53   +300us[ +938us] +/-   69ms
^+ ntp3.jst.mfeed.ad.jp          2   6    17    52  +1003us[+1003us] +/-  120ms
^+ ntp1.v6.mfeed.ad.jp           2   6    17    52  -1331us[-1331us] +/-   81ms
^+ ntp2.v6.mfeed.ad.jp           2   6    17    52   +130us[ +130us] +/-   69ms
^- ntp3.v6.mfeed.ad.jp           2   6    17    52  +1434us[+1434us] +/-  119ms
root@kozue:~# 
root@kozue:~# date
Wed Aug 14 11:39:06 JST 2019
sudo ufw allow proto udp from 10.0.8.0/22 to any port 123
root@kozue:~# systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Wed 2019-08-14 11:26:56 JST; 16min ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 679 (code=exited, status=0/SUCCESS)
   Status: "Idle."

Aug 14 09:47:45 kozue systemd-timesyncd[679]: Network configuration changed, trying to establish connection.
Aug 14 09:47:46 kozue systemd-timesyncd[679]: Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com).
Aug 14 09:47:47 kozue systemd-timesyncd[679]: Network configuration changed, trying to establish connection.
Aug 14 09:47:48 kozue systemd-timesyncd[679]: Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com).
Aug 14 10:39:22 kozue systemd-timesyncd[679]: Network configuration changed, trying to establish connection.
Aug 14 10:39:23 kozue systemd-timesyncd[679]: Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com).
Aug 14 10:41:18 kozue systemd-timesyncd[679]: Network configuration changed, trying to establish connection.
Aug 14 10:41:18 kozue systemd-timesyncd[679]: Synchronized to time server 91.189.89.199:123 (ntp.ubuntu.com).
Aug 14 11:26:56 kozue systemd[1]: Stopping Network Time Synchronization...
Aug 14 11:26:56 kozue systemd[1]: Stopped Network Time Synchronization.
root@kozue:~# systemctl disable systemd-timesyncd
Removed /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service.

References

tech/server/linux/ubuntu/ntp/chrony/chrony.txt · Last modified: 2019/08/14 11:46 by wnoguchi