准备环境: 服务端 192.168.124.73 客户端 192.168.124.147 1.下载 yum install ntp ntpdate -y 2.备份文件 cp /etc/ntp.conf /etc/ntp.conf.bak 3.编辑文件 vim /etc/ntp.conf

在里面 将#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap前面的注释去掉 再在下面添加一行 server 192.168.124.73(服务端Ip) 4.启动服务 service ntpd start

5.检测服务器是否同步 ntpq -p 6.关闭防火墙 systemctl stop firewalld setenforce 0

二、客户端配置

1.下载 yum install ntp ntpdate -y

2.编辑文件 vim /etc/ntp.conf

在里面添加 server 192.168.124.147(客户端Ip) 3.关闭防火墙 systemctl stop firewalld setenforce 0

4.等待漫长的十分钟

5.实现同步 ntpdate 192.168.124.73(服务端ip)