博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NTP时间服务器
阅读量:7091 次
发布时间:2019-06-28

本文共 1501 字,大约阅读时间需要 5 分钟。

1. NTP简介

NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议。它的用途是把计算机的时钟同步到世界协调时UTC,其精度在局域网内可达0.1ms,在互联网上绝大多数的地方其精度可以达到1-50ms。

NTP服务器就是利用NTP协议提供时间同步服务的。

2. NTP服务器安装

# 系统自带ntp[root@wen ~]# rpm -qa ntpntp-4.2.6p5-5.el6.centos.x86_64# 如果没有就安装yum -y install ntp

3. 配置NTP服务

[root@wen ~]# vim /etc/ntp.conf# restrict default kod nomodify notrap nopeer noqueryrestrict default nomodify# nomodify客户端可以同步# 将默认时间同步源注释改用可用源# 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 iburstserver ntp1.aliyun.comserver time.nist.gov

4. 启动NTP服务器

# 如果计划任务有时间同步,先注释,两种用法会冲突。[root@wen ~]# crontab -e#*/5 * * * * /usr/sbin/ntpdate time.nist.gov >/dev/null 2>&1[root@wen ~]# /etc/init.d/ntpd startStarting ntpd: [ OK ][root@wen ~]# ntpq -premote refid st t when poll reach delay offset jitter==============================================================================*ntp1.aliyun.com 10.137.38.86 2 u 22 64 1 525.885 -42.367 0.000[root@wen ~]# ntpstatsynchronised to NTP server (110.75.186.247) at stratum 3time correct to within 4257 mspolling server every 64 s[root@wen ~]# ntpdate 10.0.0.97 Dec 18:43:07 ntpdate[26950]: the NTP socket is in use, exiting

5. 客户机时间同步

客户机要等几分钟再与新启动的ntp服务器进行时间同步,否则会提示no server suitable for synchronization found错误。

[root@wen ~]# ntpdate 10.0.0.97 Dec 18:40:16 ntpdate[1453]: step time server 10.0.0.9 offset 40.880807 sec# 将命令放入计划任务即可。

 

-

 

转载于:https://www.cnblogs.com/wenyule/articles/10474615.html

你可能感兴趣的文章
大众继续深耕SUV市场:5款新车型先于上海车展登场,ID. ROOMZZ成点睛之笔 ...
查看>>
使用CODERUN部署阿里云KUBERNETES
查看>>
没有所谓好与不好,只是能否适用和用的好
查看>>
Linux基础命令---gunzip
查看>>
Linux基础命令---文本编辑
查看>>
星矿科技完成千万元融资,专注明星IP价值商业化 ...
查看>>
Linux基础命令---ipcalc计算IP地址
查看>>
一位医疗 AI 创业者的自述:这个行业到底需要什么样的产品?
查看>>
重磅福利,阿里云携手合作伙伴向公益机构免费提供40多种软件服务!
查看>>
MyBatis 自定义 typeHandler
查看>>
MES、ERP已死,中国工业互联网呼唤新的智能模式!
查看>>
SpringMVC请求乱码
查看>>
Java NIO
查看>>
使用EMR-Flume同步Kafka数据到HDFS
查看>>
SSH访问安全配置方法之一
查看>>
MySQL 性能测试
查看>>
jdbc_分页查询,大数据,批处理,存储过程
查看>>
DKhadoop安装配置步骤教程与常见问题解决
查看>>
独家揭秘!阿里大规模数据中心的性能分析
查看>>
5.DI的配置使用
查看>>