加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

设置NTP服务器以允许本地计算机同步到Linux

发布时间:2020-12-14 02:38:24 所属栏目:Linux 来源:网络整理
导读:我正在尝试设置一台机器作为ntp服务器,其他本地机器将与其同步.无论ntp服务器机器是否连接到互联网,都需要这样做,即:时间是否正确并且机器彼此同步并不重要. 我的配置文件如下: NTP服务器/etc/ntp.conf driftfile /var/lib/ntp/ntp.driftserver 0.pool.ntp
我正在尝试设置一台机器作为ntp服务器,其他本地机器将与其同步.无论ntp服务器机器是否连接到互联网,都需要这样做,即:时间是否正确并且机器彼此同步并不重要.

我的配置文件如下:

NTP服务器/etc/ntp.conf

driftfile /var/lib/ntp/ntp.drift

server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 10

restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

restrict 127.0.0.1
restrict ::1

NTP客户端/etc/ntp.conf

driftfile /var/lib/ntp/ntp.drift

server 192.168.1.146 iburst

restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

restrict 127.0.0.1
restrict ::1

我改变了服务器上的时间
然后我用sudo /etc/init.d/ntp start运行ntp服务器
并尝试测试客户端可以使用sudo ntpdate 192.168.1.146接收ntp更新

这是有效的,但只有在连接到Internet时(即使主设备的时间由我的命令设置而不是从外部ntp服务器设置).

我的配置文件中有什么错误吗?我失踪的任何一步?

解决方法

在一段时间之后,我提供了一个详细的答案,说明我们如何在数据中心完成您的工作.自从我发帖以来没有太大变化.

链接到帖子:

Using NTP to sync a group of linux servers to a common time source

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读