服务器是用旧笔记本装的 Debian13,然后用 ddns-go 做动态域名解析,但是装好之后貌似由于时钟没有校准因此 ddns-go 无法更新域名解析(使用的 aliyun),以下是解决方法。
首先我使用 timedatectl 的结果如下:
1
2
3
4
5
6
7
8
9
| ~ $ timedatectl
Local time: 六 2025-11-08 00:20:49 CST
Universal time: 五 2025-11-07 16:20:49 UTC
RTC time: 五 2025-11-07 16:20:49
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: no
NTP service: n/a
RTC in local TZ: no
|
使用 systemd-timesyncd 可以让系统自动校时:
1
| sudo timedatectl set-ntp true
|
如果显示:
1
| Failed to set ntp: NTP not supported
|
说明当前系统里没有可用的 NTP 同步服务(比如 systemd-timesyncd、chronyd 或 ntpd)被启用或支持,可以执行:
1
2
| sudo apt install systemd-timesyncd
sudo systemctl enable --now systemd-timesyncd.service
|
之后再执行 timedatectl 可以看到:
1
2
| System clock synchronized: yes
NTP service: active
|
这样就 ok 了。