centos两个(多个)服务器ntp时钟同步

12 篇文章 0 订阅
11 篇文章 1 订阅

1.安装ntp:
yum install ntp

2.修改配置文件:
vi /etc/ntp.conf
把"restrict default kod nomodify notrap nopeer noquery"注释掉(表示默认拒绝所有IP的时间同步)
把"restrict -6 default kod nomodify notrap nopeer noquery"注释掉
添加"restrict default nomodify"(允许任何IP的客户机都可以进行时间同步)

把下面几行注释掉:
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

然后添加(使用本地时间):
server 127.127.1.0
fudge 127.127.1.0 stratum 10

3.允许BIOS与系统时间同步:
vi /etc/sysconfig/ntpd
添加:SYNC_HWCLOCK="yes"

4.启动ntp服务,并添加开机启动:
service ntpd start
chkconfig ntpd on
chkconfig --list ntpd
chkconfig --level 35 ntpd on

5.防火墙设置
vi /etc/sysconfig/iptables
-A INPUT -p udp -m udp --sport 123 -j ACCEPT
service iptables restart

6.然后通过:ntpdate 192.168.3.237(这个就是上面安装ntp服务器对应的机器IP)可以进行时间同步
可能会报"no server suitable for synchronization found",
重启下ntp服务:service ntpd restart

7.注意,如果修改了ntp服务器的时间,必须要重启ntp服务,否则在其他服务器进行时间同步的时候
还会出现第六点的问题。

8.完毕
 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zhong_jianyu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值