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

     查看效果

     

  • 相关阅读:
    古典问题rabbit
    输入两个正整数m和n,求其最大公约数和最小公倍数
    水仙花数
    输入一行字符,分别统计出其中英文字母,空格,数字和其他字符的个数。
    mybatis中的#和$的区别
    SpringMVC 中整合JSON、XML视图
    Gson简要使用笔记
    Spring Framework Artifacts
    Quartz的cron表达式
    清除svn文件目录的bat脚本
  • 原文地址:https://www.cnblogs.com/zydev/p/8883604.html
Copyright © 2011-2022 走看看