NTP服务搭建

一、ntpd和ntpdate区别
1.ntpd是自动执行的远程更新本地系统时钟的服务,是平滑同步;
2.ntpdate是手工执行的服务,也就是一般用它执行一次本地时间更新,如果做成半自动,可以写入到crontab自动任务,从而变成自动任务。可能会因为时钟跃变(经历两个相同的时刻)导致许多问题,如数据库事务等,
二、安装包离线下载

rpm地址:https://rpmfind.net/linux/rpm2html/search.php

autogen-libopts-5.18-5.el7.x86_64.rpm,ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm,ntpdate-4.2.6p5-29.el7.centos.x86_64.rpm,compat-openssl10-1.0.2o-3.el8.x86_64.rpm

rpm -ivh autogen-libopts-5.18-5.el7.x86_64.rpm 
rpm -ivh ntpdate-4.2.6p5-29.el7.centos.x86_64.rpm
rpm -ivh ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm
安装ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm缺依赖时,执行:
rpm -ivh ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm --nodeps --force
三、配置ntp master
vim /etc/ntp.conf
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).driftfile /var/lib/ntp/drift# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1 
restrict ::1
server 127.127.1.0
fudge 127.127.1.0 stratum 10
# 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#broadcast 192.168.1.255 autokey        # broadcast server
#broadcastclient                        # broadcast client
#broadcast 224.0.1.1 autokey            # multicast server
#multicastclient 224.0.1.1              # multicast client
#manycastserver 239.255.254.254         # manycast server
#manycastclient 239.255.254.254 autokey # manycast client# Enable public key cryptography.
#cryptoincludefile /etc/ntp/crypto/pw# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography. 
keys /etc/ntp/keys# Specify the key identifiers which are trusted.
#trustedkey 4 8 42# Specify the key identifier to use with the ntpdc utility.
#requestkey 8# Specify the key identifier to use with the ntpq utility.
#controlkey 8# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats# Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor
启动ntpd:
systemctl start ntpd
查看状态:
systemctl status ntpd
停止ntpd:
systemctl stop ntpd
四、配置ntp client
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).driftfile /var/lib/ntp/drift# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1 
restrict ::1
server 172.17.0.3
fudge 172.17.0.3 stratum 10
# 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#broadcast 192.168.1.255 autokey        # broadcast server
#broadcastclient                        # broadcast client
#broadcast 224.0.1.1 autokey            # multicast server
#multicastclient 224.0.1.1              # multicast client
#manycastserver 239.255.254.254         # manycast server
#manycastclient 239.255.254.254 autokey # manycast client# Enable public key cryptography.
#cryptoincludefile /etc/ntp/crypto/pw# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography. 
keys /etc/ntp/keys# Specify the key identifiers which are trusted.
#trustedkey 4 8 42# Specify the key identifier to use with the ntpdc utility.
#requestkey 8# Specify the key identifier to use with the ntpq utility.
#controlkey 8# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats# Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor
查看时间服务器:
ntpq -p
查看偏差时间:
ntpdc -c loopinfo
查看ntp状态:
ntpstat

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/771760.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

maya常用快捷键

目录 移动视图 播放控制 连续播放python脚本 移动视图 按住“Alt鼠标中键”快捷键,然后拖动就能自由的移动视图。假如我们只在水平或者垂直方向上移动视图,只需按住“ShiftAlt鼠标中键”,就能在水平,或者垂直方向移动视图了。…

程序员35岁会失业吗?【来自主流AI的回答】

程序员35岁会失业吗? 35岁被认为是程序员职业生涯的分水岭,许多程序员开始担忧自己的职业发展是否会受到年龄的限制。有人担心随着年龄的增长,技术更新换代的速度会使得资深程序员难以跟上;而另一些人则认为,丰富的经…

图像变换(python)

前言 这个Python没学过,写的是真的不方便,有很多问题还没解决,暂时不想写了,感兴趣的同学可以完善一下。设计的思路就是摆几个控件然后将对应的函数实现,这个Python的坐标放置以及控件的大小我没弄懂,算出…

PCM /G711音频播放器 :Audacity

下载路径: Audacity | Free Audio editor, recorder, music making and more!

在微服务架构中如何使用 Nginx 作为入口控制器或者服务网关

声明:内容来自AI,未经验证,仅供参考! 一、在 Kubernetes 中使用 Nginx 作为 Ingress Controller: 在微服务架构和容器化部署中,Nginx 常常被用来作为入口控制器(Ingress Controller)或者服务网…

如何统计代码量

工具: cloc 下载地址: Releases AlDanial/cloc GitHub 使用方法:

武汉星起航:跨境电商行业的领军者,互帮互助共创佳绩

武汉星起航电子商务有限公司,作为跨境电商行业的领军者,以其出色的业绩和卓越的团队实力,在业内赢得了广泛的赞誉。公司自运营团队在亚马逊平台上成功开设了多家店铺,凭借着深耕跨境电商行业多年所积累的经验,取得了令…

使用mybatis-plus添加数据报错

1、报错问题 2、错误分析 无法配置数据库实体类的属性id,类型不匹配 3、解决分析 (1)数据库类型不匹配,先查看数据库数据类型是否有错误 数据库类型设计没有出现问题 (2)数据库没有问题就看实体类&#xf…

Xavier初始化方法

avier初始化方法是一种常用的神经网络参数初始化方法,旨在有效地初始化权重,以促进神经网络的训练。该方法的提出者是Xavier Glorot和Yoshua Bengio,因此得名为“Xavier”。 在深度学习中,参数初始化是至关重要的,因为…

mysql数据库报too many connections

原因: 连接数超过了 MySQL 设置的最大值,与 max_connections 和 wait_timeout 都有关系。wait_timeout 的值越大,连接的空闲等待就越长,这样就会造成当前连接数越大。 连接mysql mysql -uuser -ppassword ; -u用户名 -p密码 查…

tcp/ip是什么意思,tcp/ip协议包含哪几层

TCP/IP是一种网络通信协议,它是互联网所采用的基本协议。TCP/IP协议是由美国国防部高级研究计划局(ARPA)在上世纪70年代设计开发的,经过多年发展和完善,已成为全球范围内最重要的网络通信协议之一。 首先,让…

【CKA模拟题】Ingress新手必看,全面了解Ingress的基础操作

题干 For this question, please set this context (In exam, diff cluster name) kubectl config use-context kubernetes-adminkubernetesThere exists a deployment named nginx-deployment exposed through a service called nginx-service . Create an ingress resource…

好玩的AI生产PPT工具分享

(2024年3月23日发现的)AI生成PPT服务商: https://www.aippt.cn 这个是中国特供版。因为它是cn结尾。海外用户可以用https://www.aippt.com https://ppt.weixiu777.com 这个虽然是com结尾,其实是中国的。 使用流程 1 输入主题 2 …

【“得到”用户访谈会-参会感受】

在三月左右的时候,收到了《得到》的一个用户访谈的邀请,自己以前并没有这样的经历,所以觉得能有这样的体验还是挺不错的,所以说一说参加前后的体验。 不知道现在有多少人,还会注意,或者很频繁地使用手机上…

【项目】基于YOLOv8和RotNet实现圆形滑块验证码(拼图)自动识别(通过识别中间圆形的角度实现)

TOC 一、引言 1.1 实现目标 要达到的效果是使用算法预测中间圆形的角度,返回给服务器,实现自动完成验证码的问题。要实现的内容如下图所示。 1.2 实现思路 思路1(效果较差):以RotNet要实现的验证码识别为灵感&…

MQ消息队列从入门到精通速成

文章目录 1.初识MQ1.1.同步和异步通讯1.1.1.同步通讯1.1.2.异步通讯 1.2.技术对比: 2.快速入门2.1.安装RabbitMQ2.2.RabbitMQ消息模型2.3.导入Demo工程2.4.入门案例2.4.1.publisher实现2.4.2.consumer实现 2.5.总结 3.SpringAMQP3.1.Basic Queue 简单队列模型3.1.1.…

php 快速入门(二)

一、运算符 1.1 算术运算符 运算描述举例加$a$b-减&#xff0c;负数功能$a-$b*乘$a*$b/除$a/$b%取余$a%$b <?php$s1 3;$s2 5;$res1 $s1$s2;$res2 $s1-$s2;$res3 $s1*$s2;$res4 $s1/$s2;$res5 $s1%$s2;echo $res1."<br>";echo "${res2}<b…

web前端3.19

一、属性选择器与伪类选择器 属性选择器&#xff1a;匹配那些具有特定属性或属性值的元素 <style>/* */input[type"password"] {background-color: aqua;}/* 具有某个属性的指定标签 */div[title] {background-color: pink;}/* 属性的值中包含某个值 */inpu…

深入理解SHA系列哈希算法:安全性的保障与演进

码到三十五 &#xff1a; 个人主页 心中有诗画&#xff0c;指尖舞代码&#xff0c;目光览世界&#xff0c;步履越千山&#xff0c;人间尽值得 ! 本文将深入探讨SHA&#xff08;Secure Hash Algorithm&#xff09;系列哈希算法的工作原理、应用场景及其安全性。我们将了解SHA系…

35.基于SpringBoot + Vue实现的前后端分离-在线考试系统(项目 + 论文)

项目介绍 本站是一个B/S模式系统&#xff0c;采用SpringBoot Vue框架&#xff0c;MYSQL数据库设计开发&#xff0c;充分保证系统的稳定性。系统具有界面清晰、操作简单&#xff0c;功能齐全的特点&#xff0c;使得基于SpringBoot Vue技术的在线考试系统设计与实现管理工作系统…