在 Windows 中启用 NTP 时间同步服务并在 Linux 中设置时间同步
在 Windows 中启用 NTP 时间同步服务端
1、运行 regedi 打开注册表编辑器
2、进入路径:计算机\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer
找到 Enabled,设置其值为 1
3、进入路径:计算机\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config
找到 AnnounceFlags,设置其值为 5(十六进制)
4、在服务中找到 Windows Time 进行重启
5、在命令行中执行以下命令检查效果:
w32tm /stripchart /computer:127.0.0.1
在 Linux 中手动执行一次时间同步
ntpdate ntpserver.ip.or.domain && clock -w
在 Linux 中使用 chronyd 进行自动时间同步
1、安装 chronyd(若没有)
yum install chronyd
2、编辑配置文件,配置时间同步服务端地址
vim /etc/chrony.conf
找到最上面的 server 部分,修改其地址为所需的服务器地址
3、重启服务以便生效
systemctl restart chronyd
关于 chronyd 的更多介绍:https://yfeng9186.gitee.io/blog/2020/2/linux-%E6%97%B6%E9%97%B4%E5%90%8C%E6%AD%A5%E4%B9%8Bchronyd/
输了你,赢了世界又如何...