• 服务器端配置
    • 允许这些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. Linux Docker 部署 ASP.NET Core应用

    一.系统环境 1.腾讯云轻量应用服务器CentOS7.6 二.操作流程及途中遇到的问题 1.SSH方式远程Linux ssh <username>@<IP address or do ...

  2. Elasticserch与Elasticsearch_dsl用法

    Elasticserch与Elasticsearch_dsl用法 Elasticsearch_dsl::https://elasticsearch-dsl.readthedocs.io/en/late ...

  3. 使用Relay部署编译ONNX模型

    使用Relay部署编译ONNX模型 本文介绍如何使用Relay部署ONNX模型的入门. 首先,必须安装ONNX软件包. 一个快速的解决方案是安装protobuf编译器,然后 pip install o ...

  4. 摄像头定位:ICCV2019论文解析

    摄像头定位:ICCV2019论文解析 SANet: Scene Agnostic Network for Camera Localization 论文链接: http://openaccess.the ...

  5. Nvidia TensorRT开源软件

    TensorRT开源软件 此存储库包含NVIDIA TensorRT的开源软件(OSS)组件.其中包括TensorRT插件和解析器(Caffe和ONNX)的源代码,以及演示TensorRT平台使用和功 ...

  6. 电阻存储器为edge-AI提供了仿生架构

    电阻存储器为edge-AI提供了仿生架构 Resistive memories enable bio-inspired architectures for edge AI 近年来,脑启发计算领域的研究 ...

  7. WordPress安装篇(3):用宝塔面板在Linux上安装WordPress

    前面的文章已经介绍了如何在Windows环境安装WordPress,这篇文章来介绍在Linux环境怎样快速安装WordPress.大家都知道,Linux系统相对于Windows系统而言占用资源更少.更 ...

  8. 【NX二次开发】设置了“附加包含目录”,还是提示“无法打开包括文件”的解决方法

    项目属性中的"附加包含目录"路径完全正确,但是还是无法找到头文件: 这个问题我遇到过不止一次,纠结了很久,终于发现了解决方法: 改为: 问题解决! 分析原因:项目中的属性配置 与 ...

  9. JDK并发包一

    JDK并发包一 同步控制是并发程序必不可少的重要手段,synchronized是一种最简单的控制方法.但JDK提供了更加强大的方法----重入锁 重入锁 重入锁使用java.util.concurre ...

  10. SAI常用快捷键大全

    一.默认常用工具快捷键如下: N 铅笔 B 喷枪 V 笔 X 前/背景色切换 - 前景色与透明色切换 C 水彩笔 A 选区笔 S 选区擦 D 清空当前图层 F 向下转写 (当前图层内容合并至下层,该层 ...