系統:centos7
防火牆:關閉防火牆和selinux
軟件:chronyhtml
centos6咱們一直用的ntp時間服務器,雖然到CentOS7上也能夠裝ntp。可是各類問題。因此建議centos7使用chrony同步工具。
[root@server ~]# yum install chrony -y
[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的服務器列表linux
time1.aliyun.com
time2.aliyun.com
time3.aliyun.com
time4.aliyun.com
time5.aliyun.com
time6.aliyun.com
time7.aliyun.comvim
[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
[root@client ~]# yum install chrony -y
[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
[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 ###最後一條有*號表示同步成功