Linux时间同步:NTP

文章目录

  • 0. 参考文献
  • 1. 简介
  • 2. ntp时间同步
  • 3. 遇到的问题及解决方法
  • 4. 资源下载


0. 参考文献

Linux进阶_时间同步(NTP与chrony)
CentOS 7 中使用NTP进行时间同步
centos7 ntp时间同步

1. 简介

时间同步:多主机协作工作时,各个主机的时间同步很重要,时间不一致会造成很多重要应用的故障,如:加密协议,日志,集群等, 利用NTP(Network Time Protocol) 协议使网络中的各个计算机时间达到同步。目前NTP协议属于运维基础架构中必备的基本服务之一

ntp:将系统时钟和世界协调时UTC同步,精度在局域网内可达0.1ms,在互联网上绝大多数的地方精度可以达到1-50ms,项目官网:http://www.ntp.org

2. ntp时间同步

时间服务器需要修改ntp配置文件ntp.conf,把restrict default nomodify notrap nopeer noquery这行注释掉就可以了。如果不注释,就无法充当时间服务器了。

[root]$ yum -y install ntp
[root]$ systemctl start ntpd
[root]$ systemctl enable ntpd
[root]$ vim /etc/ntp.conf   
    #restrict default nomodify notrap nopeer noquery
    server ntp.aliyun.com iburst
[root]$ systemctl restart ntpd
[root]$ ntpq -p

Linux时间同步:NTP_第1张图片
时间客户端配置文件的设置详见参考文献。此处省略若干行……

3. 遇到的问题及解决方法

问题 解决方法
ntp起来了,但是不能时间同步 关闭防火墙:systemctl stop firewalld(关闭防火墙)、sytemctl disable firewalld(停用并禁止防火墙)(参考文献:Linux关闭防火墙命令)
修改服务器时间后,ntp时间同步失效 重启ntp服务:systemctl start ntpd(重启ntp服务)

4. 资源下载

ntp安装包
ntp.conf配置文件

你可能感兴趣的:(Linux,ntp时间同步)