Centos7搭建ntp服务器用于同步时间

CENTOS7 NTP 服务器搭建

1.配置好IP,更新好系统。
echo “test” | passwd --stdin root # 修改密码为test
2.安装ntp
前言:网络时间协议NTP(Network TimeProtocol)是时间同步的技术基础,是用来使计算机时间同步的一种协议。它可以使计算机对其服务器或时钟源做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒)。
大数据时代,整个处理计算系统内的大数据通信都是通过网络进行。大数据系统是对时间敏感的计算处理系统,时间同步是大数据能够得到正确处理的基础保障,是大数据得以发挥作用的技术支撑。大数据产生与处理系统是各种计算设备集群的
计算设备将统一、同步的标准时间用于记录各种事件发生时序,如E-MAIL信息、文件创建和访问时间、数据库处理时间等。大数据系统内不同计算设备之间控制、计算、处理、应用等数据或操作都具有时序性,若计算机时间不同步,
这些应用或操作或将无法正常进行。
[root@ntp_server ~]# yum install ntp
新增加日志文件目录
[root@ntp_server ~]# vim /etc/ntp.conf
For more information about this file, see the man pages
ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
logfile /var/log/ntpd.log #新加的
授权10.0.0.0 网段可以对时
restrict 10.0.0.0 mask 255.0.0.0 nomodify
注释原有的添加
#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 ntp1.aliyun.com
server 210.72.145.44
server 127.0.0.1
fudge 127.0.0.1 stratum 10
server 127.127.1.0 iburst# 当外部服务器不通,使用内部的时间
手工对时,使其和公网的一样
[root@ntp_server ~]# ntpdate -u ntp1.aliyun.com
重启服务
[root@ntp_server ~]# systemctl restart ntpd
防火墙放行
[root@ntp_server ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
[root@ntp_server ~]# firewall-cmd --reload
success
其他
第三步 编辑 /etc/ntp.conf
server time.windows.com
server s2m.time.edu.cn
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
server 127.127.1.0 iburst local clock 当外部时间不可用时,使用本地时间。
restrict 192.168.137.1 mask 255.255.255.0 nomodify 允许更新的IP地址段

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值