4

让我们假设我们有许多系统连接在本地网络中并且没有连接到互联网。确保每个时钟同步的最佳方法是什么?它们不必与 UTC 时间同步,但足以在它们之间同步。

我曾想过通过在其中一个系统中设置 NTP 服务器来使用 NTP。但我需要建议,与要求相比,这是否会更加麻烦。是否建议尝试使用 TCP 套接字手动计算往返时间和服务器时间?

4

1 回答 1

0

即使使用其中一台机器的无纪律的本地时钟,小型本地网络也可以相互同步的解决方案可以在一个简单的 NTP 对等网络中完成,如果所有实时源都失败,则使用本地时钟作为备份的一种设置。

多服务器/对等 ntp 网络的一个示例。注意每个 ntp 没有列出相同的服务器。这是为了更好地使用对等同步。因此对等同步可以匹配不同的时间结果。

1a  1b     1c  1d     1e  1f      outside
. \ / ...... \ / ...... \ / ..............
   2a ---p--- 2b ---p--- 2c        inside
  /|\        /|\        /|\
 / | \      / | \      / | \
3a 3b 3c   3e 3f 3g   3h 3i 3j

Key: 1 = stratum-1, 2 = stratum-2, 3 = stratum-3, p = peer
#Diagram + more info: http://www.ntp.org/ntpfaq/NTP-s-config-adv.htm

ntp 服务器 A (myntp.server.a)

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server 127.127.1.0
fudge 127.127.1.0 stratum 10

server 0.pool.ntp.org iburst 
server 1.pool.ntp.org iburst 
peer myntp.server.b
peer myntp.server.c

ntp 服务器 B (myntp.server.b)

server 2.pool.ntp.org iburst 
server 3.pool.ntp.org iburst
peer myntp.server.a
peer myntp.server.c

如果一台服务器(例如 myntp.server.a)运行本地时钟,那么一切都会同步到该时钟 - 无论多么糟糕 - 但至少网络上的时钟会保持在一起 - 查看更多信息:http ://compgroups.net/comp .protocols.time.ntp/undisciplined-local-clocks/1874258#sthash.xnGpZubJ.dpuf

更多信息:http ://doc.ntp.org/4.1.1/confopt.htm

于 2015-08-23T18:26:18.657 回答