前言:

时间服务器是S/C模型服务,需要配置服务端和客户端

NTP服务端配置:(服务端的IP为1.1.1.14)
安装ntp服务:
# yum -y install ntp
查询网络中的NTP服务器:
# ntpq -p 
No association ID's returned
修改配置文件:
# vim /etc/ntp.conf
修改如下:
#restrict default nomodify notrap nopeer noquery
restrict default nomodify

restrict 127.0.0.1
restrict ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 127.127.1.0
重启服务:
# systemctl restart ntpd.service
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*LOCAL(0) .LOCL. 5 l 40 64 1 0.000 0.000 0.000

NTP客户端配置:(客户端IP1.1.1.15)
# yum -y install ntp

修改配置文件:

# vim /etc/ntp.conf
server 1.1.1.14
# server 0.centos.pool.ntp.org iburst
# server 1.centos.pool.ntp.org iburst
# server 2.centos.pool.ntp.org iburst
# server 3.centos.pool.ntp.org iburst
进行时间同步:
# ntpdate -d 1.1.1.14
17 Aug 18:16:12 ntpdate[2420]: ntpdate 4.2.6p5@1.2349-o Fri Apr 13 12:52:28 UTC 2018 (1)
Looking for host 1.1.1.14 and service ntp
host found : iscsi-1
transmit(1.1.1.14)
receive(1.1.1.14)
transmit(1.1.1.14)
receive(1.1.1.14)
transmit(1.1.1.14)
receive(1.1.1.14)
transmit(1.1.1.14)
receive(1.1.1.14)
server 1.1.1.14, port 123
stratum 6, precision -25, leap 00, trust 000
refid [1.1.1.14], delay 0.02583, dispersion 0.00078
transmitted 4, in filter 4
reference time: df211ec3.f61979fc Fri, Aug 17 2018 18:15:31.961
originate timestamp: df211ef2.5e99e99c Fri, Aug 17 2018 18:16:18.369
transmit timestamp: df211ef2.7a146907 Fri, Aug 17 2018 18:16:18.476
filter delay: 0.02596 0.02591 0.02583 0.02591
0.00000 0.00000 0.00000 0.00000
filter offset: -0.10994 -0.10912 -0.10834 -0.10754
0.000000 0.000000 0.000000 0.000000
delay 0.02583, dispersion 0.00078
offset -0.108343

17 Aug 18:16:18 ntpdate[2420]: adjust time server 1.1.1.14 offset -0.108343 sec  (ceph默认的时间差为0.05sec)
将时间同步到硬件:
# hwclock -w
开启自动同步:
# systemctl start ntpd.service
查看服务状态:
# systemctl status ntpd.service
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2018-08-17 18:23:53 CST; 7s ago
Process: 2451 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 2452 (ntpd)
CGroup: /system.slice/ntpd.service
└─2452 /usr/sbin/ntpd -u ntp:ntp -g

Aug 17 18:23:53 iscsi-2 ntpd[2452]: 0.0.0.0 c01d 0d kern kernel time sync enabled
Aug 17 18:23:53 iscsi-2 ntpd[2452]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Aug 17 18:23:53 iscsi-2 ntpd[2452]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Aug 17 18:23:53 iscsi-2 ntpd[2452]: Listen and drop on 1 v6wildcard :: UDP 123
Aug 17 18:23:53 iscsi-2 ntpd[2452]: Listen normally on 2 lo 127.0.0.1 UDP 123
Aug 17 18:23:53 iscsi-2 ntpd[2452]: Listen normally on 3 ens33 1.1.1.15 UDP 123
Aug 17 18:23:53 iscsi-2 ntpd[2452]: Listening on routing socket on fd #20 for interface updates
Aug 17 18:23:53 iscsi-2 ntpd[2452]: 0.0.0.0 c016 06 restart
Aug 17 18:23:53 iscsi-2 ntpd[2452]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
Aug 17 18:23:53 iscsi-2 ntpd[2452]: 0.0.0.0 c011 01 freq_not_set

centos7安装配置时间服务器的更多相关文章

  1. CentOS7安装配置SAMBA服务器

    假设我们有这样一个场景 共享名 路径 权限 SHAREDOC /smb/docs 所有人员包括来宾均可以访问 RDDOCS /smb/tech 仅允许特定组的用户进行读写访问 特定组的组名为RD,目前 ...

  2. CentOS7 安装配置DNS服务器

    一.安装 yum install bind 二.配置 1. /etc/named.conf // // named.conf // // Provided by Red Hat bind packag ...

  3. CentOS7安装配置FTP服务器

    假设我们有以下要求 路径 权限 备注 /ftp/open 公司所有人员包括来宾均可以访问 只读 /ftp/private 仅允许Alice.Jack.Tom三个人访问 Alice.Jack只允许下载, ...

  4. CentOS7安装配置DNS服务器

    准备工作(假设名称为bigcloud.local) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #更改主机名称 #vi /etc/sysconfig/netwo ...

  5. (7)centos7安装配置ftp服务器

    1.安装vsftpd yum install vsftpd -y 2.设置开机启动vsftpd ftp服务 systemctl enable vsftpd.service 3.启动vsftpd服务 s ...

  6. CentOS 7.2 安装配置Samba服务器

    1背景 转Linux刚刚1年,vim操作还不能应对工程代码,之前一直都是Gnome桌面 + Clion 作开发环境,无奈在服务器上没有这样的环境, 看同事是(Windows)Source Insigh ...

  7. Centos7安装搭建NTP服务器和NTP客户端同步时间

    NTP简介: NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议. 在计算机的世界里,时间非常地重要 例如:对于火箭发射这种科研活动,对时间的 ...

  8. 大数据项目之_15_帮助文档_NTP 配置时间服务器+Linux 集群服务群起脚本+CentOS6.8 升级到 python 到 2.7

    一.NTP 配置时间服务器1.1.检查当前系统时区1.2.同步时间1.3.检查软件包1.4.修改 ntp 配置文件1.5.重启 ntp 服务1.6.设置定时同步任务二.Linux 集群服务群起脚本2. ...

  9. Centos7安装配置jenkins(Tomcat)

    Centos7安装配置jenkins(Tomcat) 一.准备工作 1.1 安装JDK1.8 具体安装过程不在赘述. 1.2 下载jenkins的war包 jenkins官网下载地址:https:// ...

随机推荐

  1. Oracle 下ASM磁盘总结

    Oracle 下ASM磁盘总结 文章转载: Oracle下创建ASM磁盘总结https://blog.csdn.net/okhymok/article/details/78791841?utm_sou ...

  2. Weblogic wls RCE 漏洞验证POC

    #!/usr/bin/env python # coding:utf-8 # @Date : 2017/12/22 17:11 # @File : weblogic_poc.py # @Author ...

  3. Python函数(八)-装饰器(一)

    装饰器通过函数来定义,用来装饰函数 装饰器的结构为高阶函数和内嵌函数 装饰器不改变被装饰函数的源代码和运行方式 如何实现这个效果呢? # -*- coding:utf-8 -*- __author__ ...

  4. Oracle Management Packs

    http://kerryosborne.oracle-guy.com/2008/10/oracle-management-packs/ There has been quite a bit of co ...

  5. opencv相关

    http://opencv.org/ ================== 不错的博客: 图像处理(小魏的修行路):http://blog.csdn.net/xiaowei_cqu/article/c ...

  6. intellij idea打包springboot项目

    一.可执行jar包 注意点: maven的package类型需要为jar 配置了spring-boot-mavne-plugin插件 1.1.pom.xml <?xml version=&quo ...

  7. java多线程编程——同步器Exchanger

    类java.util.concurrent.Exchanger提供了一个同步点,在这个同步点,一对线程可以交换数据.每个线程通过exchange()方法的入口提供数据给他的伙伴线程,并接收他的伙伴线程 ...

  8. 安装nodemon热启动

    1.安装: cnpm i nodemon -g 2.执行 nodemon .\launch.js .\config_preview\ .\launch.js 为我要启动的脚本文件 .\config_p ...

  9. 算法Sedgewick第四版-第1章基础-2.1Elementary Sortss-006归并排序(Mergesort)

    一. 1.特点 (1)merge-sort : to sort an array, divide it into two halves, sort the two halves (recursivel ...

  10. 红帽企业版RHEL7.1在研域工控板上,开机没有登陆窗口 -- 编写xorg.conf 简单三行解决Ubuntu分辩率不可调的问题

    红帽企业版RHEL7.1在研域工控板上,开机没有登陆窗口 没有登陆窗口 的原因分析: 没有登陆窗口的原因是因为有多个屏幕在工作,其中一个就是build-in 屏幕(内置的虚拟屏幕)和外接的显示器,并且 ...