当前位置:首页 > CN2资讯 > 正文内容

windows配置emacs windows配置ntp服务器

3小时前CN2资讯


建议使用 ntpd for windows,这是一个ntp的windows版,操作和linux相似

下载:https://www.meinbergglobal.com/english/sw/ntp.htm#ntp_nt

目前版本是ntp-4.2.8p7,经测试可以在win7上使用。

1、下载安装,都很简单,下一步完成。

2、配置,基本和linux差不多,安装应用目录

点击Edit Ntp Configuration,进行ntp配置,参考linux配置

#默认拒绝所有来源的任何访问 restrict default noquery nopeer nomodify notrap restrict -6 default noquery nopeer nomodify notrap # allow status queries and everything else from localhost # 允许本地访问 restrict 127.0.0.1 restrict -6 ::1 # if you need to allow access from a remote host, you can add lines like this: # restrict <IP OF REMOTE HOST> # 设置自己需要访问的网段地址 restrict 10.102.145.0 mask 255.255.255.0 nomodify restrict 10.20.0.0 mask 255.255.0.0 nomodify # Use drift file driftfile "C:\Program Files (x86)\NTP\etc\ntp.drift" # your local system clock, could be used as a backup # (this is only useful if you need to distribute time no matter how good or bad it is) # 按自己需求增加上层NTP服务器 server 0.centos.pool.ntp.org prefer server server 2.centos.pool.ntp.org server us.npt.org.cn # but it should operate at a high stratum level to let the clients know and force them to # use any other timesource they may have. fudge 127.127.1.0 stratum 10 # End of generated ntp.conf --- Please edit this to suite your needs


使用菜单中的Restart Ntp Server 重启服务。

使用Quick NTP Status查看NTP服务的状态,其实就是 watch ntpq -p;如果如下图,基本就成功了

 

然后就是你的服务器端设置了。

下面再说下一些术语解释:

# 1. 关于权限设定部分 #   权限的设定主要以 restrict 这个参数来设定,主要的语法为: #   restrict IP mask netmask_IP parameter #   其中 IP 可以是软件地址,也可以是 default ,default 就类似 0.0.0.0 #   至于 paramter 则有: #   ignore :关闭所有的 NTP 联机服务 #   nomodify:表示 Client 端不能更改 Server 端的时间参数,不过,#   Client 端仍然可以透过 Server 端来进行网络校时。 #   notrust :该 Client 除非通过认证,否则该 Client 来源将被视为不信任网域 #   noquery :不提供 Client 端的时间查询#   notrap :不提供trap这个远程事件登入 #  如果 paramter 完全没有设定,那就表示该 IP (或网域)“没有任何限制”restrict default nomodify notrap noquery # 关闭所有的 NTP 要求封包 restrict 127.0.0.1    #这是允许本级查询#在192.168.0.1/24网段内的服务器就可以通过这台NTP Server进行时间同步了 restrict 192.168.0.1 mask 255.255.255.0 nomodify# 2. 上层主机的设定 #  要设定上层主机主要以 server 这个参数来设定,语法为: #  server [IP|HOST Name] [prefer] #  Server 后面接的就是我们上层 Time Server 啰!而如果 Server 参数 #  后面加上 perfer 的话,那表示我们的 NTP 主机主要以该部主机来作为 #  时间校正的对应。另外,为了解决更新时间封包的传送延迟动作, #  所以可以使用 driftfile 来规定我们的主机 #  在与 Time Server 沟通时所花费的时间,可以记录在 driftfile #  后面接的文件内,例如下面的范例中,我们的 NTP server 与 #  cn.pool.ntp.org联机时所花费的时间会记录在 /etc/ntp/drift文件内 server 0.pool.ntp.orgserver 1.pool.ntp.org

注:windows原生的做ntp服务不是很稳定,建议重要环境不要使用,不然要死翘翘

  1. 修改注册表项

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer

  Enabled 设定为 1(默认0)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\

  AnnounceFlags 设定为 5 (默认 10)

         宣布标志值:
                0 Timeserv_Announce_No,Reliable_Timeserv_Announce_No。域控制器不公布时间服务。
                1 Timeserv_Announce_Yes。域控制器始终通告时间服务。
                2 Timeserv_Announce_Auto。域控制器自动确定是否应该通告时间服务。
                4 Reliable_Timeserv_Announce_Yes。域控制器将始终通告可靠的时间服务。
                8 Reliable_Timeserv_Announce_Auto。域控制器自动确定是否应该通告可靠的时间服务。
                标志5(1 + 4)表示“域控制器始终通告时间服务”和“域控制器将始终通告可靠的时间服务”。

     2. 禁用防火墙或设置例外,UDP 123端口。

   3. 运行 services.msc,将Windows Time服务设置成自动(延迟启动)

 

网络设备(如cisco、h3c交换机……)不能正常同步NTP服务器时间:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\LocalClockDispersion

值修改为0 (默认为0x0000000a)

    你可能想看:

    扫描二维码推送至手机访问。

    版权声明:本文由皇冠云发布,如需转载请注明出处。

    本文链接:https://www.idchg.com/info/30162.html

    分享给朋友:

    “windows配置emacs windows配置ntp服务器” 的相关文章