我的 chrony 时间服务器可以从另一个内部时间服务器获取时间,但不能从互联网上的时间服务器获取时间:
chronyc sources
210 Number of sources = 9
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^? ptbtime1.ptb.de 0 7 0 - +0ns[ +0ns] +/- 0ns
^? static.133.158.47.78.cli> 0 7 0 - +0ns[ +0ns] +/- 0ns
^? alpha.rueckgr.at 0 7 0 - +0ns[ +0ns] +/- 0ns
^? stratum2-2.NTP.TechFak.N> 0 7 0 - +0ns[ +0ns] +/- 0ns
^? totoro.ax86.net 0 7 0 - +0ns[ +0ns] +/- 0ns
^? 195.50.171.101 0 7 0 - +0ns[ +0ns] +/- 0ns
^? 82.165.77.164 0 7 0 - +0ns[ +0ns] +/- 0ns
^? 79.133.44.136 0 7 0 - +0ns[ +0ns] +/- 0ns
^? ntp1.radio-sunshine.org 0 7 0 - +0ns[ +0ns] +/- 0ns
chronyc tracking
Reference ID : 00000000 ()
Stratum : 0
Ref time (UTC) : Thu Jan 01 00:00:00 1970
System time : 0.000000009 seconds fast of NTP time
Last offset : +0.000000000 seconds
RMS offset : 0.000000000 seconds
Frequency : 0.379 ppm fast
Residual freq : +0.000 ppm
Skew : 0.000 ppm
Root delay : 1.000000000 seconds
Root dispersion : 1.000000000 seconds
Update interval : 0.0 seconds
Leap status : Not synchronised
nc -zvu ptbtime1.ptb.de 123
Connection to ptbtime1.ptb.de 123 port [udp/ntp] succeeded!
我会非常高兴收到能够解决问题的建议。
迄今为止执行的验证步骤:
以下是建议的验证步骤的结果:
不,您的所有来源均未返回 NTP 数据包,包括 ptbtime1.ptb.de。?状态为不可达,与可达的 0 相同。nc 不是完整测试,它仅发送一些不含任何内容的 UDP 数据包。
我可以使用哪种工具?我尝试在其他 NTP 服务器上使用 nmap socat,但无法建立连接。
检查 chrony 是否认为它与 chronyc 活动在线。
chronyc activity
200 OK
39 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
0 sources with unknown address
恢复网络连接并通过 chronyc online 告知 chrony
netplan apply
chronyc online
200 OK
检查防火墙是否允许 udp/123 目的地。
请告诉我应该使用哪种工具。
但我们可以看到防火墙是打开的:
telnet www.google.de 80
Trying 216.58.212.163...
Connected to www.google.de.
nc -zvu ptbtime1.ptb.de 123
Connection to ptbtime1.ptb.de 123 port [udp/ntp] succeeded!
检查本地 NTP 服务是否正在运行并允许该主机
chrony.service - chrony, an NTP client/server
Loaded: loaded (/lib/systemd/system/chrony.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-12-23 09:56:51 CET; 2h 12min ago
Docs: man:chronyd(8)
man:chronyc(1)
man:chrony.conf(5)
Main PID: 221814 (chronyd)
Tasks: 2 (limit: 1074)
Memory: 1.7M
CGroup: /system.slice/chrony.service
├─221814 /usr/sbin/chronyd -F -1
└─221815 /usr/sbin/chronyd -F -1
Dec 23 12:05:19 chrony-time-server chronyd[221814]: Source 2606:4700:f1::1 offline
Dec 23 12:05:19 chrony-time-server chronyd[221814]: Source 2a01:4f8:221:b52::2 offline
Dec 23 12:05:30 chrony-time-server chronyd[221814]: Source 2607:f8f8:721:e301::123 online
Dec 23 12:05:30 chrony-time-server chronyd[221814]: Source 2a01:4f8:141:282::5:1 online
Dec 23 12:05:30 chrony-time-server chronyd[221814]: Source 2402:1f00:8000:800::414 online
Dec 23 12:05:30 chrony-time-server chronyd[221814]: Source 2a01:4f8:202:144d::2 online
Dec 23 12:05:30 chrony-time-server chronyd[221814]: Source 2001:67c:1560:8003::c7 online
Dec 23 12:05:30 chrony-time-server chronyd[221814]: Source 2001:67c:1560:8003::c8 online
Dec 23 12:05:30 chrony-time-server chronyd[221814]: Source 2606:4700:f1::1 online
Dec 23 12:05:30 chrony-time-server chronyd[221814]: Source 2a01:4f8:221:b52::2 online
说明资源在线。
尝试已知提供公共访问的 NTP 服务器,例如 2.pool.ntp.org
nano /etc/chrony/chrony.conf
pool pool.ntp.org iburst
server 192.53.103.108 iburst
pool 2.pool.ntp.org iburst
server 0.de.pool.ntp.org iburst
server 1.de.pool.ntp.org iburst
server 2.de.pool.ntp.org iburst
server 3.de.pool.ntp.org iburst
pool ntp.ubuntu.com iburst maxsources 4
pool 0.ubuntu.pool.ntp.org iburst maxsources 1
pool 1.ubuntu.pool.ntp.org iburst maxsources 1
pool 2.ubuntu.pool.ntp.org iburst maxsources 2
与网络上具有 NTP 服务的工作设备进行比较。
实际时间服务器正在运行ntp.service
:
● ntp.service - Network Time Service
Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-11-12 09:47:21 CET; 1 months 10 days ago
Docs: man:ntpd(8)
Main PID: 773 (ntpd)
Tasks: 2 (limit: 1074)
Memory: 2.0M
CGroup: /system.slice/ntp.service
└─773 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 112:117
Dec 22 12:40:07 ntp-time-server ntpd[773]: Soliciting pool server 136.243.202.118
Dec 22 12:40:08 ntp-time-server ntpd[773]: Soliciting pool server 131.234.220.232
Dec 22 12:40:10 ntp-time-server ntpd[773]: Soliciting pool server 78.46.162.102
Dec 22 12:40:11 ntp-time-server ntpd[773]: Soliciting pool server 213.239.239.165
Dec 22 12:40:12 ntp-time-server ntpd[773]: Soliciting pool server 144.76.76.107
Dec 22 12:40:13 ntp-time-server ntpd[773]: Soliciting pool server 82.100.248.10
Dec 22 13:52:03 ntp-time-server ntpd[773]: Soliciting pool server 195.201.163.190
Dec 22 13:52:04 ntp-time-server ntpd[773]: Soliciting pool server 162.159.200.1
Dec 23 05:50:20 ntp-time-server ntpd[773]: 213.239.239.165 local addr 10.0.16.254 -> <null>
Dec 23 09:46:11 ntp-time-server ntpd[773]: Soliciting pool server 162.159.200.123
ntpstat
synchronised to NTP server (79.133.44.141) at stratum 2
time correct to within 16 ms
polling server every 128 s
我已经检查了以上所有内容,看起来一切正常,但是 chrony 仍然不起作用:
chronyc tracking
Reference ID : 00000000 ()
Stratum : 0
Ref time (UTC) : Thu Jan 01 00:00:00 1970
System time : 0.000000027 seconds fast of NTP time
Last offset : +0.000000000 seconds
RMS offset : 0.000000000 seconds
Frequency : 0.379 ppm fast
Residual freq : +0.000 ppm
Skew : 0.000 ppm
Root delay : 1.000000000 seconds
Root dispersion : 1.000000000 seconds
Update interval : 0.0 seconds
Leap status : Not synchronised
chronyc ntpdata
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
Reference time : Thu Jan 01 00:00:00 1970
Offset : +0.000000000 seconds
Peer delay : 0.000000000 seconds
Peer dispersion : 0.000000000 seconds
Response time : 0.000000000 seconds
Jitter asymmetry: +0.00
NTP tests : 000 000 0000
Interleaved : No
Authenticated : No
TX timestamping : Invalid
RX timestamping : Invalid
Total TX : 24
Total RX : 0
Total valid RX : 0
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
Reference time : Thu Jan 01 00:00:00 1970
Offset : +0.000000000 seconds
Peer delay : 0.000000000 seconds
Peer dispersion : 0.000000000 seconds
Response time : 0.000000000 seconds
Jitter asymmetry: +0.00
NTP tests : 000 000 0000
Interleaved : No
Authenticated : No
TX timestamping : Invalid
RX timestamping : Invalid
Total TX : 24
Total RX : 0
Total valid RX : 0
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
Reference time : Thu Jan 01 00:00:00 1970
Offset : +0.000000000 seconds
Peer delay : 0.000000000 seconds
Peer dispersion : 0.000000000 seconds
Response time : 0.000000000 seconds
Jitter asymmetry: +0.00
NTP tests : 000 000 0000
Interleaved : No
Authenticated : No
TX timestamping : Invalid
RX timestamping : Invalid
Total TX : 24
Total RX : 0
Total valid RX : 0
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
Reference time : Thu Jan 01 00:00:00 1970
Offset : +0.000000000 seconds
Peer delay : 0.000000000 seconds
Peer dispersion : 0.000000000 seconds
Response time : 0.000000000 seconds
Jitter asymmetry: +0.00
NTP tests : 000 000 0000
Interleaved : No
Authenticated : No
TX timestamping : Invalid
RX timestamping : Invalid
Total TX : 24
Total RX : 0
Total valid RX : 0
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
Reference time : Thu Jan 01 00:00:00 1970
Offset : +0.000000000 seconds
Peer delay : 0.000000000 seconds
Peer dispersion : 0.000000000 seconds
Response time : 0.000000000 seconds
Jitter asymmetry: +0.00
NTP tests : 000 000 0000
Interleaved : No
Authenticated : No
TX timestamping : Invalid
RX timestamping : Invalid
Total TX : 24
Total RX : 0
Total valid RX : 0
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
Reference time : Thu Jan 01 00:00:00 1970
Offset : +0.000000000 seconds
Peer delay : 0.000000000 seconds
Peer dispersion : 0.000000000 seconds
Response time : 0.000000000 seconds
Jitter asymmetry: +0.00
NTP tests : 000 000 0000
Interleaved : No
Authenticated : No
TX timestamping : Invalid
RX timestamping : Invalid
Total TX : 24
Total RX : 0
Total valid RX : 0
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
Reference time : Thu Jan 01 00:00:00 1970
Offset : +0.000000000 seconds
Peer delay : 0.000000000 seconds
Peer dispersion : 0.000000000 seconds
Response time : 0.000000000 seconds
Jitter asymmetry: +0.00
NTP tests : 000 000 0000
Interleaved : No
Authenticated : No
TX timestamping : Invalid
RX timestamping : Invalid
Total TX : 24
Total RX : 0
Total valid RX : 0
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
Reference time : Thu Jan 01 00:00:00 1970
Offset : +0.000000000 seconds
Peer delay : 0.000000000 seconds
Peer dispersion : 0.000000000 seconds
Response time : 0.000000000 seconds
Jitter asymmetry: +0.00
NTP tests : 000 000 0000
Interleaved : No
Authenticated : No
TX timestamping : Invalid
RX timestamping : Invalid
Total TX : 24
Total RX : 0
Total valid RX : 0
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
Reference time : Thu Jan 01 00:00:00 1970
Offset : +0.000000000 seconds
Peer delay : 0.000000000 seconds
Peer dispersion : 0.000000000 seconds
Response time : 0.000000000 seconds
Jitter asymmetry: +0.00
NTP tests : 000 000 0000
Interleaved : No
Authenticated : No
TX timestamping : Invalid
RX timestamping : Invalid
Total TX : 24
Total RX : 0
Total valid RX : 0
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
Reference time : Thu Jan 01 00:00:00 1970
Offset : +0.000000000 seconds
Peer delay : 0.000000000 seconds
Peer dispersion : 0.000000000 seconds
Response time : 0.000000000 seconds
Jitter asymmetry: +0.00
NTP tests : 000 000 0000
Interleaved : No
Authenticated : No
TX timestamping : Invalid
RX timestamping : Invalid
Total TX : 0
Total RX : 0
Total valid RX : 0
Remote address : [UNSPEC] (00000000)
Remote port : 0
Local address : [UNSPEC] (00000000)
Leap status : Normal
Version : 0
Mode : Invalid
Stratum : 0
Poll interval : 0 (1 seconds)
Precision : 0 (1.000000000 seconds)
Root delay : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID : 00000000 ()
答案1
不,您的所有源均未返回 NTP 数据包,包括ptbtime1.ptb.de
。状态不可达,与可达性 ?
相同。这不是完整的测试,它仅发送一些不含任何内容的 UDP 数据包。0
nc
- 使用 检查 chrony 是否认为它在线
chronyc activity
。使用 恢复网络连接并告知 chronychronyc online
- 检查防火墙是否允许 udp/123 目的地。
- 检查您本地的 NTP 服务是否正在运行并允许该主机。
- 尝试已知提供公共访问的 NTP 服务器,例如
2.pool.ntp.org
与网络上具有 NTP 服务的工作设备进行比较。