
1 Linux
NTP 客户端主机需要 ntpupdate 软件包来和服务器同步时间。可以轻松地使用 yum 或 apt-get 安装这个软件包。安装完软件包之后,用服务器的 IP 地址运行下面的命令。
# ntpdate <server-IP-address>
基于 RHEL 和 Debian 的系统命令都相同。
2 Windows
如果你正在使用 Windows,在日期和时间设置(Date and Time settings)下查找网络时间(Internet Time)。
3 Cisco 设备
如果你想要同步 Cisco 设备的时间,你可以在全局配置模式下使用下面的命令。
# ntp server <server-IP-address>
来自其它厂家的支持 NTP 的设备有自己的用于网络时间的参数。如果你想将设备和 NTP服务器同步时间,请查看设备的说明文档。
结论
总而言之,NTP 是在你的所有主机上同步时钟的一个协议。我们已经介绍了如何设置 NTP 服务器并使支持 NTP 的设备和服务器同步时间。个人linux系统比如ubuntu、deepin等都已经安装了,只需要勾选同步网络时间即可。
如果是服务器可以参考:
[root@localhost /]# yum install ntp -y
2修改NTP配置文件,添加NTP服务器的网络位置 /etc/ntpconf
# For more information about this file, see the man pages
# ntpconf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5)
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system
restrict default nomodify notrap nopeer noquery
# Permit all access over the loopback interface This could
# be tightened as well, but to do so would effect some of
# the administrative functions
restrict 127001
restrict ::1
# Hosts on local network are less restricted
#restrict 19216810 mask 2552552550 nomodify notrap
# Use public servers from the poolntporg projectPlease consider joining the pool (>当你配置正确,你可以用Windows Time(W32Time)service 建一个SNTP/NTP服务器为Windows或非windows客户端提供时间服务。
步骤如下:
1打开开始菜单,点击运行输入regedit打开Windows注册表。 2找到如下位置
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config 3找到AnnounceFlags 双击修改值为5保存。 4 开启NTPServer
1在注册表中找到如下位置:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer\ 2找到Enable并修改其值为1
5打开开始菜单输入CMD在命令行模式下输入:
net stop w32time && net start w32time 重启一下win32time服务。 ----------------------------- 需要注意的问题:
1 在系统服务中设置W32Time服务启动模式为自动。 2确定防火墙允许UDP123端口访问。
这样你可以在NTP客户端上测试从这台服务器校对系统时间啦。
也可参考下面的资料:>步骤如下:
n Enable NTP mode:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
将“TYPE”的值改为"NTP"
n Enable the NTP Client:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config
将“AnnounceFlags”值改为5
n Specify the upstream NTP servers to sync from:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders
设定 “NtpServer”值为3 个 NTP servers
例如: 1poolntporg,0x1 2poolntporg,0x1 3poolntporg,0x1(3个服务器之间用空格)
注意:在Windows2008域控中,NtpServer这个键值在:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters下。
n Specify a 2-minute interval:
KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient
设定:“SpecialPollInterval”值为120
n启用NTP功能
KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer
设定:“Enabled”值为1
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)