Linux chrony服务器配置
配置目标:chrony服务部署:两台机器a: 第一台机器从阿里云同步时间第二台机器从第一台机器同步时间b: 第一台服务器使用系统时间作为第二台服务器的时钟源, 第一台服务器层级设置为6
·
配置目标:
chrony服务部署:两台机器
a: 第一台机器从阿里云同步时间
第二台机器从第一台机器同步时间
b: 第一台服务器使用系统时间作为第二台服务器的时钟源, 第一台服务器层级设置为6
a:
安装chrony,关闭防火墙与selinux
yum -y install chrony
systemctl stop firewalld.service
setenforce 0
配置
vim /etc/chrony.conf
#将原有的pool注释掉,并添加阿里云的时间服务器
#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 ntp.aliyun.com iburst
#允许其它客户端连接到此台时钟服务器
allow all
启动并验证是否配置正确
systemctl start chronyd
chronyc sources -v
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 203.107.6.88 2 6 377 30 +1586us[+2716us] +/- 39ms
第二台机器同样安装chrony,关闭防火墙与selinux
将第二台服务器要同步的时间服务器IP设置为第一台
vim /etc/chrony.conf
#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 192.168.85.128 iburst
启动第二台服务器并验证是否配置正确
systemctl start chronyd
chronyc sources -v
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 192.168.85.128 3 6 7 2 -3254ns[+2908us] +/- 58m
b:
将第一台服务器所有同步的时钟服务器注释掉,并将本地层级设置为6
vim /etc/chrony.conf
#server ntp.aliyun.com iburs
local stratum 6
重启并验证
systemctl restart chronyd
chronyc tracking
Reference ID : 7F7F0101 ()
Stratum : 6 #成功
Ref time (UTC) : Thu Jan 05 06:05:52 2023
System time : 0.000000000 seconds slow of NTP time
Last offset : +0.000000000 seconds
RMS offset : 0.000000000 seconds
Frequency : 10.785 ppm slow
Residual freq : +0.000 ppm
Skew : 0.000 ppm
Root delay : 0.000000000 seconds
Root dispersion : 0.000000000 seconds
Update interval : 0.0 seconds
Leap status : Normal
更多推荐
已为社区贡献1条内容
所有评论(0)