簡體   English   中英

如何在本地網絡中同步時鍾?

[英]How to synchronise clocks in a local network?

讓我們假設我們有多個系統連接在本地網絡中,但未連接到Internet。 什么是確保每個時鍾同步的最佳方法? 它們不必與UTC時間保持同步,但足以彼此之間保持同步。

我曾想過通過在其中一個系統中設置NTP服務器來使用NTP。 但是我需要建議,與要求相比這是否麻煩得多。 還建議嘗試使用TCP套接字手動計算往返時間和服務器時間嗎?

即使所有實時源均發生故障,也可以在一個簡單的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 /散漫和本地時鍾/ 1874258#sthash.xnGpZubJ.dpuf

詳細信息: http : //doc.ntp.org/4.1.1/confopt.htm

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM