为什么 timesyncd 客户端没有收到来自 NTP 服务器的任何回复(回复超时)?

为什么 timesyncd 客户端没有收到来自 NTP 服务器的任何回复(回复超时)?

systemd-timesyncd.service在我的 lubuntu 22.04 中,启动守护进程的服务处于活动状态systemd-timesyncd(请参阅这里文档)。这是此服务的状态:

> systemctl status systemd-timesyncd

# this is the output of the previous command:
● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2023-07-06 12:21:43 CEST; 2min 54s ago
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 1917 (systemd-timesyn)
     Status: "Idle."
      Tasks: 2 (limit: 2030)
     Memory: 1.3M
        CPU: 201ms
     CGroup: /system.slice/systemd-timesyncd.service
             └─1917 /lib/systemd/systemd-timesyncd

lug 06 12:21:55 ceia-te systemd-timesyncd[1917]: Timed out waiting for reply from 185.125.190.57:123 (ntp.ubuntu.com).
lug 06 12:22:05 ceia-te systemd-timesyncd[1917]: Timed out waiting for reply from 185.125.190.58:123 (ntp.ubuntu.com).
lug 06 12:22:15 ceia-te systemd-timesyncd[1917]: Timed out waiting for reply from 185.125.190.56:123 (ntp.ubuntu.com).
lug 06 12:22:25 ceia-te systemd-timesyncd[1917]: Timed out waiting for reply from 91.189.94.4:123 (ntp.ubuntu.com).

输出显示服务正在运行并尝试连接 NTP 服务器ntp.ubuntu.com但未收到任何回复(参见消息Timed out waiting for reply from ntp.ubuntu.com);通过以下命令的输出我们可以看到,该服务器可以通过 ping 访问:

> ping ntp.ubuntu.com
PING ntp.ubuntu.com (91.189.94.4) 56(84) bytes of data.
64 bytes from pugot.canonical.com (91.189.94.4): icmp_seq=1 ttl=53 time=30.0 ms
64 bytes from pugot.canonical.com (91.189.94.4): icmp_seq=2 ttl=53 time=29.8 ms
64 bytes from pugot.canonical.com (91.189.94.4): icmp_seq=3 ttl=53 time=29.8 ms

防火墙iptables未处于活动状态:

> sudo iptables --list
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

有人能告诉我为什么 timesyncd 客户端没有收到来自 NTP 服务器的任何回复ntp.ubuntu.com吗?

谢谢

答案1

问题出在互联网服务提供商

感谢您的评论。我尝试连接到另一个网络它可以通过我写这篇文章时使用的网络的另一种方式连接到互联网。
通过这个其他网络,无需对配置文件进行任何修改,配置文件/etc/systemd/timesyncd.conf如下:

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

NTP客户端systemd timesyncd可以将系统日期同步到NTP服务器ntp.ubuntu.com

事实上该服务的状态systemd-timesyncd.service如下:

systemctl 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 Thu 2023-07-06 14:12:48 CEST; 46min ago
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 2065 (systemd-timesyn)
     Status: "Initial synchronization to time server 185.125.190.56:123 (ntp.ubuntu.com)."
      Tasks: 2 (limit: 2030)
     Memory: 1.3M
        CPU: 203ms
     CGroup: /system.slice/systemd-timesyncd.service
             └─2065 /lib/systemd/systemd-timesyncd

lug 06 14:12:48 ceia-te systemd[1]: Starting Network Time Synchronization...
lug 06 14:12:48 ceia-te systemd[1]: Started Network Time Synchronization.
lug 06 14:12:13 ceia-te systemd-timesyncd[2065]: Initial synchronization to time server 185.125.190.56:123 (ntp.ubuntu.com).

因此,无需对 lubuntu 配置进行任何修改,也无需安装任何其他包,系统就可以正常运行。

相关内容