linux中设置ntp时间同步

NTP全称为Network Time Protocol,即网络时间协议。是用来使计算机时间同步的一种协议。它可以使计算机对服务器或时钟源做同步,可以提供高精度的时间校正(LAN 上与标准时间小于1毫秒,WAN上几十毫秒),而且可以由加密确认的方式防止恶意的协议***。

实验环境
两台虚拟机 NTP时间服务器 192.168.43.57
主机 192.168.43.29

服务端

安装ntp

yum install -y ntp

编辑配置文件 vim /etc/ntp.conf

linux中设置ntp时间同步

将这行给注释
#restrict default nomodify notrap nopeer noquery

linux中设置ntp时间同步

开启ntp服务: systemctl start ntpd

客户端

安装ntp服务: yum -y install ntp

修改配置文件,添加上层时间服务器

linux中设置ntp时间同步

开启ntp服务:service ntpd start

同步时间: ntpdate 192.168.43.57

猜你喜欢

转载自blog.51cto.com/14375809/2430587