ntp时间同步服务

作用:ntp主要是用于对计算机的时间同步管理操作。

环境;
服务端:192.168.1.13
客户端:192.168.1.14
时间是对服务器来说是很重要的,一般很多网站都需要读取服务器时间来记录相关信息,如果时间不准,则可能造成很大的影响。

下载
yum -y install ntp

编辑文件
vim /etc/ntp.conf

  server 127.127.1.0                        #本地时钟地址,以本机作为时间服务器,也可以根据需要选择阿里时间服务器
  restrict 127.0.0.1                        #允许本机使用时间服务器
  restrict 172.20.10.7 mask 255.255.255.240  #允许172.20.10.7使用本机的时间服务器

重启服务
systemctl restart ntpd
systemctl enable ntpd #设置开机启动

客户端同步
手动:ntpdate 192.168.1.13

自动:
vim /etc/ntp.conf
里面添加server 192.168.1.13
如图所示
ntp时间同步服务
查看上层ntp服务状态
ntpq -p
ntp时间同步服务