前言:

时间服务器是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

最新文章

  1. Maven配置Nexus私服
  2. [Linux]服务管理:rpm包, 源码包
  3. ytu 1940:Palindromes _easy version(水题)
  4. demo02TextView
  5. UEditor上传功能
  6. [转]p2p端口映射工具 dog-tunnel
  7. hdu 3572 Task Schedule (dinic算法)
  8. jQuery实现鼠标滑过导航栏呈现不同的样式
  9. java+jsp+sql server实现网页版四则运算.
  10. JDBC控制事务
  11. NGUI_slider
  12. Dynamics CRM2016 关闭错误报告弹框提示
  13. ArrayList类源码解析——ArrayList动态数组的实现细节(基于JDK8)
  14. Tomcat中的backlog参数
  15. 工作笔记—新浪微博Oauth2.0授权 获取Access Token (java)
  16. git使用简明教程
  17. 聚合查询、分组查询、F&Q查询
  18. windows 10 下配置安装node.js
  19. 20155204 王昊《网络对抗技术》EXP3
  20. JAVA-JSP内置对象之response对象实现页面自动刷新

热门文章

  1. AngularJS:SQL
  2. linux命令 把Windows 文件拷贝到linux
  3. delphi 在线程中运行控制台命令(console)
  4. linux命令-vim
  5. NoSQL概述
  6. Swing绘图机制
  7. js转化与排序
  8. opencv 基本数据结构
  9. Integer类的parseInt和valueOf的区别
  10. Laradock使用教程(新手版)