系统:centos7
防火墙:关闭防火墙和selinux
软件:chrony

centos6我们一直用的ntp时间服务器,虽然到CentOS7上也可以装ntp。但是各种问题。所以建议centos7使用chrony同步工具。

服务端配置:

1.安装chrony软件
[root@server ~]# yum install chrony -y
2.修改配置文件
[root@server ~]# vim /etc/chrony.conf

server 0.centos.pool.ntp.org iburst     #可以修改ntp的服务器。最好用国内的。
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst allow 172.19.150.0/24 #打开允许同步的IP

阿里ntp的服务器列表

time1.aliyun.com
time2.aliyun.com
time3.aliyun.com
time4.aliyun.com
time5.aliyun.com
time6.aliyun.com
time7.aliyun.com

3.启动、开机自启动、查看状态、查看同步源
[root@server ~]# systemctl start chronyd

[root@server ~]# systemctl enable chronyd

[root@server ~]# systemctl status chronyd
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since 一 2018-04-23 11:25:38 CST; 6min ago [root@server ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* time4.aliyun.com 2 6 17 41 +87us[+1374us] +/- 28ms

客户端配置:

1. 安装chrony
[root@client ~]# yum install chrony -y
2. 修改配置文件
[root@client ~]# vim /etc/chrony.conf 

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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 172.19.150.105 iburst #添加server
3.启动、开机自启动、查看状态、查看同步源
[root@client ~]# date
Sat Sep 9 00:00:02 CST 2017 [root@client ~]# systemctl start chronyd [root@client ~]# systemctl enable chronyd [root@client ~]# systemctl status chronyd
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2017-09-09 00:00:11 CST; 7 months 13 days ago
Docs: man:chronyd(8) [root@client ~]# date
Sat Sep 9 00:00:13 CST 2017 [root@client ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 172.19.150.105 3 6 17 3 +52us[ +107us] +/- 32ms
###最后一条有*号表示同步成功

最新文章

  1. 【单页应用巨坑之History】细数History带给单页应用的噩梦
  2. http应用优化和加速说明-负载均衡
  3. MySQL学习笔记——函数
  4. Gradle学习系列之四——增量式构建
  5. 我写了本破书-swift语言实战晋级
  6. 【@ContextConfiguration】java世界的那些注解
  7. Sphinx 排序模式 SetSortMode
  8. Swift中出现“no such module cocoa”的错误
  9. Docker ( Is docker really better than VM ?)
  10. 学习笔记——备忘录模式Memento
  11. java虚拟机学习-JVM调优总结(5)
  12. XGBoost原理和公式推导
  13. 一种hyperscan API使用(1)
  14. django-registration
  15. hdu 2167 方格取数 【状压dp】(经典)
  16. 一、集合框架(Collection和Collections的区别)
  17. 伸展树(Splay)复杂度证明
  18. 远程登录-出现身份验证错误[可能是由于CredSSP加密Oracle修正]
  19. 解决使用Qt creator时出现Cannot overwrite file ..Permission denied
  20. 关于ApplicationContext的初始化

热门文章

  1. Linux系统下文件压缩与打包命令
  2. Kotlin构造方法详解与初始化过程分析
  3. 关于使用scipy.stats.lognorm来模拟对数正态分布的误区
  4. xss获取cookie源码附利用代码
  5. 错误:找不到或无法加载主类(myEclipse and IDEA)
  6. .net框架-队列(Queue)
  7. GITHUB添加SSH内容
  8. BZOJ 2406 矩阵(二分+有源汇上下界可行流)
  9. MySQL Innodb引擎调优
  10. OFDM为什么要在频域内插后做fftshift