NTP时钟同步

本文介绍了如何设置3台机器进行NTP时钟同步。首先选择一台机器A作为同步服务,使其与外网同步,然后配置允许B和C机器同步A。在A机器上编辑`/etc/ntp.conf`文件,添加限制和服务器配置,接着启动NTP服务并检查同步状态。B和C机器同样编辑NTP配置文件,指定A为同步源,最后启动NTP服务并手动触发同步。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

设置3台机器

 

选择一台机器作为同步服务A,A与外网同步,B,C 同步A

       配置A:sudo vi /etc/ntp.conf

              删除默认配置:

  #restrict default kod nomodify notrap nopeer noquery

 #restrict -6 default kod nomodify notrap nopeer noquery

#restrict 127.0.0.1

#restrict -6 ::1

 

#server 0.centos.pool.ntp.org

#server 1.centos.pool.ntp.org

#server 2.centos.pool.ntp.org

              添加配置

                     允许那些机器与我同步

                     restrict 192.168.59.0 mask 255.255.255.0 nomodify notrap

                     配置A跟谁同步  

                     server 202.112.10.36

                    

                     配置本地同步

                      server 127.127.1.0

                     fudge  127.127.1.0 stratum 10

             

              启动ntp服务

                     sudo service ntpd start

              查看同步状态:  

                     ntpstat

       配置B,C:

              sudo vi /etc/ntp.conf

                     server 192.168.59.211

              手动触发同步:

                     sudo ntpdate 192.168.59.211

             启动ntp服务

                     sudo service ntpd start

 

            

    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值