• NTP时间同步服务器设置


    一、Window Server设置

    【服务器端设置】
    1) 修改注册表以下键值:
    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeTimeProvidersNtpServerEnabled=1
    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeConfigAnnounceFlags=5

    2) 重启NTP服务
    net stop w32Time && net start w32Time

    3) 调整防火墙设置,开启NTP端口

    【客户端设置】
    方法1) <-该方法未测试成功
    修改注册表以下键值:
    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeTimeProvidersNtpClientSpecialPollInterval=43200 (十进制)
    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeTimeProvidersNtpClientSpecialPollTimeRemaining=192.168.1.1,0 (192.168.1.1替换为实际的NTP服务器IP)

    方法2) <-该方法经测试有效
    net time /setsntp:"192.168.1.1,0x01"
    net stop w32Time && net start w32Time
    w32tm /resync /nowait /rediscover

    二、Linux

    安装NTP:
    yum install ntp

    配置时间源
    vi /etc/ntp.conf
    server 210.72.145.44
    server ntp.api.bz
    server 2.centos.pool.ntp.org

    配置对客户端(172.16.0.0/24的网段机器)提供NTP服务
    # vi /etc/ntp.conf
    restrict 172.16.0。0 mask 255.255.255.0 nomodify notrap


    配置NTP Server的层数提供本地服务
    server  127.127.1.0     # local clock
    fudge   127.127.1.0 stratum 2

    设置开机时自动运行时间服务
    chkconfig ntpd on

    启动或停止时间服务
    # service ntpd start
    # service ntpd stop
    # service ntpd restart

    验证ntp服务已经运行
    pgrep ntpd

    更新本服务器的时间
    ntpdate -u 210.72.145.44

    配置iptable规则允许客户端访问本机NTP Sever
    vi /etc/sysconfig/iptables
    增加一行(NTP Server使用UDP 123端口)
    -A INPUT -m state --state NEW -m udp -p udp --dport 123 -j ACCEPT

    重启iptables
    service iptables restart

  • 相关阅读:
    6 款好用到爆的 JSON 处理工具,极大提高效率!
    task最佳实践
    Mac系统维护工具System Toolkit激活版
    多引擎数据库管理JetBrains DataGrip 2022激活版
    centos7使用iptables
    gitlab创建账号密码
    gitlab为项目添加新成员
    gitlab推送代码报错remote: GitLab: You are not allowed to push code to protected branches on this project.
    IDEA正版激活/永久激活
    mongdb学习
  • 原文地址:https://www.cnblogs.com/freetalent/p/3944369.html
Copyright © 2020-2023  润新知