天天看點

RFC1305: NTP

  NTP協定全稱網絡時間協定(Network Time Procotol)。它的目的是在國際網際網路上傳遞統一、标準的時間。具體的實作方案是在網絡上指定若幹時鐘源網站,為使用者提供授時服務,并且這些網站間應該能夠互相比對,提高準确度。

  NTP最早是由美國Delaware大學的Mills教授設計實作的,從1982件最初提出到現在已發展了将近20年,2001年最新的NTPv4精确度已經達到了200毫秒。對于實際應用,又有確定秒級精度的SNTP(簡單的網絡時間協定)。本項目使用網上時間傳遞格式NTPv3公布于1992年,目前幾乎所有的授時網站都是基于NTPv3的。

  NTP provides the mechanisms to synchronize time and coordinate time distribution in a large, diverse internet operating at rates from mundane to lightwave. It uses a returnable-time design in which a distributed subnet of time servers operating in a self-organizing, hierarchical-master-slave configuration synchronizes local clocks within the subnet and to national time standards via wire or radio. The servers can also redistribute reference

time via local routing algorithms and time daemons.

NTP的工作模式:

1. 主/被動對稱模式:一對一的連接配接,雙方均可同步對方或被對方同步,先發出申請建立連接配接的一方工作在主動模式下,另一方工作在被動模式下。

2. 客戶/伺服器模式:與主/被動模式基本相同。唯一差別在于,客戶方可被伺服器同步,但伺服器不能被客戶同步。

3. 廣播模式:一對多的連接配接,伺服器不論客戶工作在何種模式下,主動發出時間資訊,客戶由此資訊調整自己的時間,此時網絡延時d2忽略,是以在準度上有損失,但可滿足秒級應用。

  通常情況下很多學習sip的人都比較不關心ntp,但是協定中很多地方會提到ntp,那主要是保證該資料時間上的唯一性,即ntp資料的長度。根據協定解釋,該資料的長度一般是2的64次方(由數字組成)。

繼續閱讀