1.题目要求
chrony服务部署:两台机器
a: 第一台机器从阿里云同步时间
第二台机器从第一台机器同步时间
b: 第一台服务器使用系统时间作为第二台服务器的时钟源, 第一台服务器层级设置为6
2.内容
a:
第一台机子:
查看ip:
[root@hezhihao ~]# ifconfig
设置selinux:
[root@hezhihao ~]# setenforce 0
[root@hezhihao ~]# getenforce
Permissive
关闭防火墙:
[root@hezhihao ~]# systemctl stop firewalld
查看状态:
[root@hezhihao ~]# systemctl status firewalld
[root@hezhihao ~]# systemctl status chronyd
在/etc/chrony.conf配置阿里云
[root@hezhihao ~]# vim /etc/chrony.conf
server ntp.aliyun.com iburst,原先里边的pool使用#注释掉
allow:默认情况下不允许任何ntp客户端访问,将allow前面的#注释掉
配置完重启服务
[root@hezhihao ~]# systemctl restart chronyd
测试阿里云,确保链路链路通
[root@hezhihao ~]# ping ntp.aliyun.com
开启网络时间同步
timedatectl set-ntp true
[root@hezhihao ~]# timedatectl set-ntp true
使用timedatectl
使用chronyc sources
使用chronyc tracking
[root@hezhihao ~]# chronyc tracking
第二台机子:
[root@hezhihao1 ~]# systemctl disable firewall
[root@hezhihao1 ~]# systemctl status chronyd
[root@hezhihao1 ~]# vim /etc/chrony.conf
[root@hezhihao1 ~]# systemctl restart chronyd
b:
第一台机子:
配置server ip
配置层数stratum
local stratum 10: 1-15-> 只是表达了距离真正时钟源比较源
[root@hezhihao ~]# systemctl restart chronyd
[root@hezhihao ~]# timedatectl set-ntp true
[root@hezhihao ~]# timedatectl status
在第二台机子查看: