一.配置server主机要求如下:
1.server主机的主机名称为 ntp_server.example.com
2.server主机的IP为: 172.25.254.100
3.server主机的时间为1984-11-11 11:11:11
4.配置server主机的时间同步服务要求可以被所有人使用
二.设定clinet主机要求如下
1.client主机的IP为:172.25.254.200
2.client主机的主机名称为: client.example.com
3.同步172.25.254.100主机的时间到达本机
4.用命令显示对于172.25.254.100主机的时间同步情况
计划一设置s机
1】 hostnamectl set-hostname ntp_server.example.com //修改主机名
2】 nmcli connection add con-name eth0 ifname eth0 ipv4.method manual type ethernet ipv4.addresses 172.25.254.100/24 ipv4.gateway 172.25.254.2 ipv4.dns 114.114.114.114 //主机ip配置
3】 systemctl stop chronyd.service //关闭时间同步服务
timedatectl set-time "1984-11-11 11:11:11" //设置时间
## timedatectl //检查时间
4】在vim /etc/chrony.conf写入server ntp.ntsc.ac.cn iburst
(systemctl restart chronyd.service
(systemctl disable --now firewalld //重启防火墙
计划二c机设置
1】 hostnamectl set-hostname client.example.com //修改主机名
2】nmcli connection add con-name eth0 ifname eth0 ipv4.method manual type ethernet ipv4.addresses 172.25.254.200/24 ipv4.gateway 172.25.254.2 ipv4.dns 114.114.114.114 //主机ip配置
3】
在vim /etc/chrony.conf 写入server 172.25.254.100 iburst
systemctl restart chronyd.service //重启时间同步服务
最后一步时间同步开始
用#timedatectl与#chronyc sources -v来检查同步情况