• 服务器端配置
    • 允许这些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. urllib2连接超时设置

    #urllib2设置超时 #获取网页的源码 def getHtml(url,i): if i > 2: return try: req = urllib2.Request(url) time.s ...

  2. Locust性能测试工具核心技术@task和@events

    Tasks和Events是Locust性能测试工具的核心技术,有了它们,Locust才能称得上是一个性能工具. Tasks 从上篇文章知道,locustfile里面必须要有一个类,继承User类,当性 ...

  3. Linux下RAID磁盘阵列的原理与搭建

    RAID概念 磁盘阵列(Redundant Arrays of Independent Disks,RAID),有"独立磁盘构成的具有冗余能力的阵列"之意. 磁盘阵列是由很多价格较 ...

  4. 【原创】X86下ipipe接管中断/异常

    目录 X86 ipipe接管中断/异常 一.回顾 二.X86 linux异常中断处理 1. 中断门及IDT 2. 初始化门描述符 2.1 早期异常处理 2.2 start_kernel中的异常向量初始 ...

  5. CVPR2019论文看点:自学习Anchor原理

    CVPR2019论文看点:自学习Anchor原理 原论文链接:https://arxiv.org/pdf/1901.03278.pdf CVPR2019的一篇对anchor进行优化的论文,主要将原来需 ...

  6. Wide & Deep的OneFlow网络训练

    Wide & Deep的OneFlow网络训练 HugeCTR是英伟达提供的一种高效的GPU框架,专为点击率(CTR)估计训练而设计. OneFlow对标HugeCTR搭建了Wide & ...

  7. 合宙Luat | 电源设计——模块应用必看的2个要点

    在模块应用设计中,电源设计是很重要的一部分. 由于射频发射时,会在短时间有一个较大电流的突发脉冲.在突发脉冲阶段内,电源必须能够提供高的峰值电流,不然有可能会引起供电电压的跌落.   而很多初学的朋友 ...

  8. Oracle数据库delete删除普通堆表千万条记录

    Oracle数据库delete删除普通堆表千万条历史记录. 直接删除的影响: 1.可能由于undo表空间不足从而导致最终删除失败的问题: 2.可能导致undo表空间过度使用,影响到其他用户正常操作. ...

  9. 【spring源码系列】之【Bean的生命周期】

    为源码付出的每一分努力都不会白费. 1. Bean的实例化概述 前一篇分析了BeanDefinition的封装过程,最终将beanName与BeanDefinition以一对一映射关系放到beanDe ...

  10. Custom Controller CollectionQT样式自定义 003 :Bubblemessage 气泡消息窗

    效果Demo 思路大致上是加定时器,触发完成出现 - 停留 - 消失的效果. 源码:https://github.com/linzD00/CustomControllerLibrary