• FreeBSD NTP 简单使用


    FreeBSD NTP 简单使用

    来源 https://blog.csdn.net/stevexk/article/details/1349506

    1.ntptrace xxx.xxx.xxx.xxx
    查找要对时的服务器状态,可以trace到一级时钟服务器,
    2.ntpq -p 或者 ntpq -pn
    显示当前时钟服务器状态
    3.ntpdata xxx.xxx.xxx.xxx  或者 ntpdata -d xxx.xxx.xxx.xxx (Debug模式)
    与时钟服务器对时,着先时钟服务器要先对时,才能用来提钟时钟服务
    4.ntpd
    既可以自动对时,又可对外提供时钟服务,先要配置/etc/ntp.conf

    restrict 0.0.0.0 mask 0.0.0.0 notrust nomodify notrap //控制访问
    server xxx.xxx.xxx.xxx  //对时的外部服务器
    server 127.127.1.0  
    fudge 127.127.1.0 stratum 10
    driftfile /etc/ntpd.drift


    5.开机对时,/etc/rc.conf中添加
     ntpdate_enable="YES" 
     ntpdate_program="/usr/sbin/ntpdate"
     ntpdate_flags="-b"

    6.每天(好像是每天)对时且对外提供时钟服务,  在/etc/rc.conf中添加

     xntpd_enable="YES"
     xntpd_program="/usr/sbin/ntpd"
     xntpd_flags="-p /var/run/ntpd.pid"

    7.端口
     时钟服务器端口为123,udp , netstat  -an

    # We won't allow *anything* from hosts not listed in the configuration
    # This means you need a restrict line for each server
    restrict default ignore
    restrict -6 default ignore
    
    # Allow just about anything from localhost, IPv4. 
    restrict 127.0.0.1 mask 255.0.0.0 
    
    restrict 127.0.0.1
    restrict -6 ::1
    
    driftfile /var/tmp/ntp.drift
    logfile /var/log/ntpd.log
    
    # Log everything, even from ntpd (which otherwise defaults to "all =sync")
    logconfig =all +all
    
    server 127.127.1.0
    fudge 127.127.1.0 stratum 5
    
    server 182.92.12.11 minpoll 6 maxpoll 10 
    restrict 182.92.12.11 nomodify notrap nopeer noquery

    /etc/ntp.common.conf

    # Common elements of NTP configuration
    #
    # Do not edit: changes will be lost following reboot. 
    # For site-specific NTP configuration, see the instructions in /etc/ntp.conf
    #
    
    # We won't allow *anything* from hosts not listed in the configuration
    # This means you need a restrict line for each server
    restrict default ignore
    restrict -6 default ignore
    
    # Allow just about anything from localhost, IPv4. 
    restrict 127.0.0.1 mask 255.0.0.0 
    
    restrict 127.0.0.1
    restrict -6 ::1
    
    driftfile /var/tmp/ntp.drift
    logfile /var/log/ntpd.log
    
    # Log everything, even from ntpd (which otherwise defaults to "all =sync")
    logconfig =all +all
    
    server 127.127.1.0
    fudge 127.127.1.0 stratum 5

    /etc/ntp.conf  

    includefile /etc/ntp.common.conf
    server 218.75.4.130 minpoll 6 maxpoll 10 
    restrict 218.75.4.130 nomodify notrap nopeer noquery

    常用的Ntp服务器:

    203.107.6.88
    ntp.aliyun.com
    ntp1.aliyun.com
    ntp2.aliyun.com
    ntp3.aliyun.com
    ntp4.aliyun.com
    ntp5.aliyun.com
    ntp6.aliyun.com
    ntp7.aliyun.com
    ntp8.aliyun.com

  • 相关阅读:
    hdu1593(find a way to escape)
    每日学习小记 11/02
    将博客搬至CSDN
    浏览器渲染机制
    适配器模式 The Adapter Pattern
    工厂方法模式 The Factory Method Pattern
    观察者模式 The Observer Pattern
    模板方法模式 The Template Method Pattern
    命令模式 The Command Pattern
    迭代器模式 The Iterator Pattern
  • 原文地址:https://www.cnblogs.com/lsgxeva/p/9035643.html
Copyright © 2020-2023  润新知