CentOS下配置NTP时间服务器

配置ntp.conf

[root@server ~]# 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
restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap
restrict ntp.aliyun.com nomodify
restrict cn.pool.ntp.org nomodify

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

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 ntp.aliyun.com iburst prefer
server cn.pool.ntp.org iburst
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.

#crypto

includefile /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

参数说明:

restrict IP地址 mask 子网掩码

​ 其中 IP 可以是IP地址,也可以是 default ,default 就是指所有的IP,默认拒绝所有操作。:
ignore :关闭所有的 NTP 联机服务
nomodify:客户端不能更改服务端的时间参数,但是客户端可以通过服务端进行网络校时。
notrust :客户端除非通过认证,否则该客户端来源将被视为不信任子网
noquery :不提供客户端的时间查询

notrap : 不提供trap远端事件登录功能

nopeer : 不与 同一层的ntp服务器进行时间同步

kod : 阻止kiss of death包对服务器的破坏

server IP地址或域名 [prefer]

注:IP地址或域名就是我们指定的上级时间服务器,如果 Server 参数最后加上 prefer,表示我们的 NTP 服务器主要以该部主机时间进行校准。解决NTP服务器校准时间时的传送延迟

Original: https://www.cnblogs.com/shiqiang-lee/p/16155208.html
Author: 何以卿卿
Title: CentOS下配置NTP时间服务器

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/606488/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • C++的回调函数

    一、简介 本文主要介绍C++中如何使用回调函数。 二、回调函数介绍 回调函数主要在”回”字,和正常的函数调用方式不太一样。正常的函数由开发者自己定义返回类型…

    Linux 2023年6月7日
    0100
  • Redis主从配置总结

    grep ‘^[a-Z]’ /usr/local/redis/conf/redis.conf bind 127.0.0.1 192.168.27.115 protected-mod…

    Linux 2023年5月28日
    094
  • bash脚本-周末定时备份mysql数据库

    1.脚本如下 #usr/bin/sh #program:用于每周日定时备份全天候mysql文件 #author:sundz #version:v1 20220521 #定义文件夹和…

    Linux 2023年6月7日
    0104
  • Lvs

    Lvs Lvs Lvs简介 体系结构 LVS管理工具 配置 lvs-nat 模式的 httpd 负载集群—http 配置lvs-nat模式的httpd负载集群&#821…

    Linux 2023年6月6日
    0119
  • Springboot 实现Redis 同数据源动态切换db

    参考:https://developer.aliyun.com/article/952648 Original: https://www.cnblogs.com/herd/p/16…

    Linux 2023年5月28日
    0101
  • 什么?Android上面跑Linux?

    前言 众所周知,现在程序员因为工作、个人兴趣等对各种系统的需求越来越大,部分人电脑做的还是双系统。其中,比较常见的有各种模拟器、虚拟机在windows上面跑Android、Linu…

    Linux 2023年5月27日
    085
  • angular typescript 引入js文件

    第一步,将js文件放在应该放的位置,我是自己随便建了个js测试一下。 第二步,在angular.json里引入js。 第三步,在要使用的地方声明,然后就可以使用。 注意点:angu…

    Linux 2023年6月7日
    082
  • [20220228]enq TX

    [20220228]enq TX – allocate ITL entry的测试3.txt –//上个星期的测试有点乱,重新规划测试. 1.环境:SCOTT…

    Linux 2023年6月13日
    089
  • 输入输出函数

    IDLE name=input(‘输入’) print(name) print函数 print(1,2) print(1,2,sep=",") input函数 …

    Linux 2023年6月8日
    084
  • 秒懂悲观、乐观锁、互斥、自旋锁、读写锁

    前言 生活中用到的锁,用途都比较简单粗暴,上锁基本是为了防止外人进来、电动车被偷等等。 但生活中也不是没有 BUG 的,比如加锁的电动车在「广西 – 窃·格瓦拉」面前,…

    Linux 2023年6月14日
    0108
  • redis cluster 数据迁移

    1,先停止java的后台和.net的后台,停止对redis cluster进行访问 2,然后 cd /usr/local/redis-cluster/7001 每个节点都要做如下操…

    Linux 2023年5月28日
    086
  • 从 Hadoop 到云原生, 大数据平台如何做存算分离

    Hadoop 的诞生改变了企业对数据的存储、处理和分析的过程,加速了大数据的发展,受到广泛的应用,给整个行业带来了变革意义的改变;随着云计算时代的到来, 存算分离的架构受到青睐,企…

    Linux 2023年6月14日
    057
  • Python之元类详解

    一、引子 元类属于Python面向对象编程的深层魔法,99%的人都不得要领,一些自以为搞明白元类的人其实也是自圆其说,点到为止,从队元类的控制上来看就破绽百出,逻辑混乱; 二、什么…

    Linux 2023年6月14日
    092
  • Linux指令_曾佳豪

    一、基础指令 1、ls指令 含义:ls (list) 用法1 :#ls 含义:列出当前工作目录下所有文件/文件夹的名称 [En] Meaning: list the names o…

    Linux 2023年5月27日
    0121
  • 16-ArrayList和LinkedList的区别

    1.1、作用 ArrayList和LinkedList都是实现了List接口的容器类,用于存储一系列的对象引用。它们可以对元素的增删改查进行操作 对于ArrayList,它在集合的…

    Linux 2023年6月7日
    086
  • 华为ensp网络拓扑图使用MSTP、OSPF、DHCP、端口聚合以及PPP(CHAP认证)

    404. 抱歉,您访问的资源不存在。 可能是网址有误,或者对应的内容被删除,或者处于私有状态。 代码改变世界,联系邮箱 contact@cnblogs.com 园子的商业化努力-困…

    Linux 2023年6月7日
    0100
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球