• 服务器端配置
    • 允许这些IP向自己同步时间

      restrict x.x.x.x mask x.x.x.x nomodiy notrap

    • 当前定义的所有server服务器无法同步后,和自身同步

server 127.127.1.0

fudge 127.127.1.0 stratum 10

  • 局域网内的上层时间服务器

    server 192.168.1.117

  • 客户端配置

    创建自动任务计划

    crontab -e

    * 2 * * * /usr/sbin/ntpdate 192.168.x.x

    #分 时 日 月 星期 命令位置

  • 故障排除
    • 故障信息:

      #[root@localhost ~]# ntpdate 192.168.70.52

      #27 Sep 05:22:11 ntpdate[2392]: no server suitable for synchronization found

    • 防火墙问题

    • NTP服务器和/etc/ntp.conf

    • 3.3.bug版本

  • 配置说明
    • Linux默认的/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 #系统时间与BlOS时间的偏差记录

# Permit time synchronization with our time source, but do not

# permit the source to query or modify the service on this system.

restrict default kod nomodify notrap nopeer noquery

restrict -6 default kod 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 -6 ::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.rhel.pool.ntp.org iburst #互联网时间服务器地址

server 1.rhel.pool.ntp.org iburst

server 2.rhel.pool.ntp.org iburst

server 3.rhel.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

  • restrict 命令说明

#restrict 控制相关权限---语法为: restrict IP地址 mask 子网掩码 参数

其中IP地址也可以是default ,default 就是指所有的IP

参数有以下几个:

ignore :关闭所有的 NTP 联机服务

nomodify:客户端不能更改服务端的时间参数,但是客户端可以通过服务端进行网络校时。

notrust :客户端除非通过认证,否则该客户端来源将被视为不信任子网

noquery :不提供客户端的时间查询:用户端不能使用ntpq,ntpc等命令来查询ntp服务器

notrap :不提供trap远端登陆:拒绝为匹配的主机提供模式 6 控制消息陷阱服务。陷阱服务是 ntpdq 控制消息协议的子系统,用于远程事件日志记录程序。

nopeer :用于阻止主机尝试与服务器对等,并允许欺诈性服务器控制时钟

kod : 访问违规时发送 KoD 包。

restrict -6 表示IPV6地址的权限设置。

Linux_NTP的更多相关文章

随机推荐

  1. Python - random 库的详细使用

    前言 为啥突然写这个?因为用到就写呗,感觉对生成数据很有用,之前都是百度别人的,今天来对着官方文档写,超级标准! 这边只讲常用的,看了下文档还有什么数学方法,太高级好像用不上 返回整数 random. ...

  2. [ Java面试题 ]Java 开发岗面试知识点解析

    如背景中介绍,作者在一年之内参加过多场面试,应聘岗位均为 Java 开发方向. 在不断的面试中,分类总结了 Java 开发岗位面试中的一些知识点. 主要包括以下几个部分: Java 基础知识点 Jav ...

  3. DDD划分领域、子域,核心域,支撑域的目的

    名词解释 在DDD兴起的原因以及与微服务的关系中曾举了一个研究桃树的例子,如果要研究桃树,将桃树根据器官分成根.茎.叶.花.果实.种子,这每一种器官都可以认为是一个研究领域,而领域又有更加具体的细分, ...

  4. js中reduce用法详解

    介绍reduce reduce() 方法接收一个函数作为累加器,reduce 为数组中的每一个元素依次执行回调函数,不包括数组中被删除或从未被赋值的元素,接受四个参数:初始值(上一次回调的返回值),当 ...

  5. CUDA 11功能清单

    CUDA 11功能清单 基于NVIDIA Ampere GPU架构的新型NVIDIA A100 GPU在加速计算方面实现了最大的飞跃.A100 GPU具有革命性的硬件功能,CUDA 11与A100一起 ...

  6. Linux实现ffmpeg H.265视频编码

    Linux实现ffmpeg H.265视频编码 几乎所有观看的视频,数字地面电视,电缆,卫星或互联网上的压缩.原始的,未压缩的视频太大,会浪费太多的带宽.在DVD和Blu-ray之前,有视频CD(VC ...

  7. YOLOv4:目标检测(windows和Linux下Darknet 版本)实施

    YOLOv4:目标检测(windows和Linux下Darknet 版本)实施 YOLOv4 - Neural Networks for Object Detection (Windows and L ...

  8. 72 个网络应用安全实操要点,全方位保护 Web 应用的安全

    原文地址:Web Application Security Checklist 原文作者:Teo Selenius(已授权) 译者 & 校正:HelloGitHub-小熊熊 & 卤蛋 ...

  9. 『言善信』Fiddler工具 — 11、Fiddler中Composer功能详解

    目录 1.Composer功能介绍 2.Composer界面说明 3.使用方式 (1)自定义Request请求 (2)Composer重复发送请求 (3)Composer篡改请求数据 1.Compos ...

  10. 618技术特辑(三)直播带货王,“OMG买它”的背后,为什么是一连串技术挑战?

    [本期推荐]为什么一到大促,我们的钱包总是被掏空?是大家自制力不够,还是电商平台太会读懂人心,从技术维度,抽丝剥茧一探究竟. 摘要:动辄几十上百万人同时在线的直播间,让所有人能同时公平的去抢购,并且还 ...