NTP 往返延迟

4 synchronization cisco broadcast ntp

NTP 如何计算往返延迟时间和偏移量。

Arn*_*rno 6

要将其时钟与远程服务器同步,NTP 客户端必须计算往返延迟时间和偏移量。往返延迟计算为

delta = (t_3 - t_0) - (t_2- t_1)
Run Code Online (Sandbox Code Playgroud)

在哪里

t0 is the client's timestamp of the request packet transmission,
t1 is the server's timestamp of the request packet reception,
t2 is the server's timestamp of the response packet transmission and
t3 is the client's timestamp of the response packet reception. 
Run Code Online (Sandbox Code Playgroud)

所以

t3 ? t0 is the time elapsed on the client side between the emission 
        of the request packet and the reception of the response packet and
t2 ? t1 is the time the server waited before sending the answer.
Run Code Online (Sandbox Code Playgroud)

偏移θ由下式给出

theta = ((t_1 - t_0) + (t_2 - t_3))/2
Run Code Online (Sandbox Code Playgroud)

当客户端和服务器之间的传入和传出路由具有对称的标称延迟时,NTP 同步是正确的。如果路线没有共同的标称延迟,则同步具有向前和向后旅行时间差一半的系统偏差。

必须有两种方式的通信以允许同步。使用 NTP 时间作为来自 NTP 服务器的广播会及时留下未知错误。