ntp简介+时间同步服务搭建 (实用工具)

NTP简介

NTP是网络时间同步协议,就是用来同步网络中各个计算机的时间的协议。

准备两台centos7环境测试

一个server端(136) 一个客户端(137)

在这里插入图片描述

1.关掉防火墙 setenforce

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0

2.在server端安装配置ntp服务

[root@localhost ~]# yum -y install ntp
[root@localhost ~]# vim /etc/ntp.conf 

5NDg0NTE=,size_16,color_FFFFFF,t_70#pic_center)

3.启动查看ntp

[root@localhost ~]# systemctl start ntpd
[root@localhost ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*LOCAL(0)        .LOCL.           5 l    4   64    1    0.000    0.000   0.000
 114.118.7.161   123.139.33.3     2 u    3   64    1   80.643  271.746   0.000
 203.107.6.88    100.107.25.114   2 u    2   64    1   17.522  311.783   0.000

4.在客户端安装ntpdate

[root@localhost ~]# yum -y install ntpdate

测试

1.在server端模拟修改下时间

[root@localhost ~]#  date -s "2018-08-8 04:53"
2018年 08月 08日 星期三 04:53:00 CST

2.在客户端同步服务器时间 查看时间

[root@localhost ~]# ntpdate -u 192.168.27.136
 8 Aug 04:56:25 ntpdate[13694]: step time server 192.168.27.136 offset 38531233.207033 sec
 
[root@localhost ~]# date
2018年 08月 08日 星期三 04:56:03 CST

测试的时候可能有延迟 等个30秒左右

猜你喜欢

转载自blog.csdn.net/Q274948451/article/details/109053722
今日推荐