在没有互联网的情况下同步 linux 时钟

lcg*_*ida 2 linux internet clock

如果这台 linux 机器无法访问互联网,我如何更新 linux 机器的时钟?

这台机器在网络中,其他机器可以访问互联网,但这个特定的机器不能。

我可以创建一个脚本来向另一台机器询问正确的时间并将其放在 cron.conf 上吗?

hai*_*img 6

在两台计算机上运行NTP服务器。

在可以访问 Internet 的计算机上,设置全局服务器以进行这样的查询,在/etc/ntp.conf(使用pool.ntp.org 中离您最近的服务器):

服务器 0.us.pool.ntp.org
服务器 1.us.pool.ntp.org

无法访问 Internet的计算机上,使用上面设置的本地服务器,例如 in /etc/ntp.confuse

服务器 your.local.server.hostname

严格来说,您不必在无法访问 Internet 的计算机上使用 NTP 服务器,您可以getdate在 cron 作业中使用类似的东西,但 NTP 提供了更强大的解决方案。