PG1X

My Knowledge Base

User Tools

Site Tools


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

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tech:server:linux:ubuntu:ntp:chrony:chrony [2019/08/14 11:46] (current)
wnoguchi created
Line 1: Line 1:
 +====== Configure Chrony NTP Server on Ubuntu Server 18.04 LTS ======
 +
 +{{tag>​NTP Chrony Ubuntu Linux}}
 +
 +<​code>​
 +apt install chrony
 +</​code>​
 +
 +<file txt /​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
 +</​file>​
 +
 +<​code>​
 +sudo systemctl restart chrony
 +sudo systemctl status chrony
 +</​code>​
 +
 +<​code>​
 +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
 +</​code>​
 +
 +<​code>​
 +sudo chronyc sources
 +</​code>​
 +
 +<​code>​
 +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
 +</​code>​
 +
 +<​code>​
 +sudo ufw allow proto udp from 10.0.8.0/22 to any port 123
 +</​code>​
 +
 +<​code>​
 +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.
 +</​code>​
 +
 +===== References =====
 +
 +  - [[https://​www.server-world.info/​query?​os=Ubuntu_18.04&​p=ntp&​f=2|Ubuntu 18.04 LTS : NTPサーバーの設定(Chrony) : Server World]]
 +  - [[http://​jjy.nict.go.jp/​tsp/​PubNtp/​qa.html#​q2-5|日本標準時(JST)グループ]]
 +  - [[https://​www.mfeed.ad.jp/​ntp/​detail.html|INTERNET MULTIFEED CO.]]
 +  - [[tech:​server:​linux:​ubuntu:​ufw:​ufw]]
  
tech/server/linux/ubuntu/ntp/chrony/chrony.txt · Last modified: 2019/08/14 11:46 by wnoguchi