zoukankan      html  css  js  c++  java
  • 搭建ntp服务器

    1.同步网络时间

      先关闭掉ntp服务,使用ntpd同步网络时间。

    /etc/init.d/ntpd stop

    ntpdate 2.hk.pool.ntp.org

    网络时间可以从http://www.pool.ntp.org中获取离自己最近的区域,我这里选的香港

    2. 配置/etc/ntp.conf

     更改server

    server 2.hk.pool.ntp.org
    server 0.asia.pool.ntp.org
    server 3.asia.pool.ntp.org
    

     设置权限:

    参数有以下几个:

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

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

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

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

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

    restrict default kod nomodify notrap nopeer noquery
    restrict 127.0.0.1
    restrict 192.168.0.0 mask 255.255.255.0 nomodify
    3. 开放端口123
    iptables -A INPUT -p udp --dport 123 -j ACCEPT
    /etc/init.d/iptables save
    
     
    4. 客户端设施 

    我们在客户机上同步刚才搭建的时间服务器了,192.168.0.80就是我刚搭建的。

    server 192.168.0.80 prefer
    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

     查看效果

     

  • 相关阅读:
    node 父子进程传递对象
    js 按照字母进行分组
    native react 代码智能提示
    VScode 使用emmet
    c# webapi swagger
    c# 前台和后台线程
    Java——字节和字符的区别
    Java——类的访问修饰符
    Java——面向对象
    Java——内存中的数组
  • 原文地址:https://www.cnblogs.com/zydev/p/8883604.html
Copyright © 2011-2022 走看看