ntp工作过程

[root@centos6 logs]# tcpdump port 123 -vv
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
15:26:02.417921 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 76)
    172.18.110.101.ntp > 114.80.81.1.ntp: [ bad udp cksum 8256!] NTPv4, length 48                            -->客户端发起时间校验,udp校验和错误,但是不影响使用
        Client, Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 6s, precision -19
        Root Delay: 0.000000, Root dispersion: 0.002975, Reference-ID: (unspec)
          Reference Timestamp:  0.000000000
          Originator Timestamp: 3547953085.375634335 (2012/06/06 14:31:25)
          Receive Timestamp:    3546660296.572161377 (2012/05/22 15:24:56)                                   -->客户端的当前时间
          Transmit Timestamp:   3546660362.417906163 (2012/05/22 15:26:02)
            Originator - Receive Timestamp:  -1292788.803472957                                                            -->与服务器的时间差
            Originator - Transmit Timestamp: -1292722.957728171
15:26:02.573882 IP (tos 0x0, ttl 46, id 44778, offset 0, flags [none], proto UDP (17), length 76)
    114.80.81.1.ntp > 172.18.110.101.ntp: [udp sum ok] NTPv4, length 48
        Server, Leap indicator:  (0), Stratum 2 (secondary reference), poll 6s, precision -19
        Root Delay: 0.141281, Root dispersion: 0.013046, Reference-ID: clock.isc.org
          Reference Timestamp:  3547953071.150161125 (2012/06/06 14:31:11)                                 -->服务器返回的时间戳
          Originator Timestamp: 3546660362.417906163 (2012/05/22 15:26:02)
          Receive Timestamp:    3547953151.380694855 (2012/06/06 14:32:31)
          Transmit Timestamp:   3547953151.380723113 (2012/06/06 14:32:31)
            Originator - Receive Timestamp:  +1292788.962788691                                                           -->服务器比客户端时间快的秒数
            Originator - Transmit Timestamp: +1292788.962816949
15:27:03.451400 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 76)                  -->向另外一台服务器发起对时请求
    172.18.110.101.ntp > 216.45.57.38.ntp: [bad udp cksum 814c!] NTPv4, length 48
        Client, Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 6s, precision -19
        Root Delay: 0.000000, Root dispersion: 0.003890, Reference-ID: (unspec)
          Reference Timestamp:  0.000000000
          Originator Timestamp: 3547953147.470567139 (2012/06/06 14:32:27)
          Receive Timestamp:    3546660358.699125226 (2012/05/22 15:25:58)
          Transmit Timestamp:   3546660423.451383206 (2012/05/22 15:27:03)
            Originator - Receive Timestamp:  -1292788.771441912
            Originator - Transmit Timestamp: -1292724.019183933
15:27:03.451433 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 76)                     -->向第三台发起对时请求
    172.18.110.101.ntp > mail.melancthon.net.ntp: [bad udp cksum 2bb7!] NTPv4, length 48
        Client, Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 6s, precision -19
        Root Delay: 0.000000, Root dispersion: 0.003890, Reference-ID: (unspec)
          Reference Timestamp:  0.000000000
          Originator Timestamp: 3547953147.604954961 (2012/06/06 14:32:27)
          Receive Timestamp:    3546660358.823149831 (2012/05/22 15:25:58)
          Transmit Timestamp:   3546660423.451426872 (2012/05/22 15:27:03)
            Originator - Receive Timestamp:  -1292788.781805130
            Originator - Transmit Timestamp: -1292724.153528089
15:27:03.843280 IP (tos 0x0, ttl 45, id 0, offset 0, flags [DF], proto UDP (17), length 76)
    mail.melancthon.net.ntp > 172.18.110.101.ntp: [udp sum ok] NTPv4, length 48
        Server, Leap indicator:  (0), Stratum 2 (secondary reference), poll 6s, precision -20
        Root Delay: 0.001541, Root dispersion: 0.044952, Reference-ID: clock.nyc.he.net
          Reference Timestamp:  3547951252.414146931 (2012/06/06 14:00:52)
          Originator Timestamp: 3546660423.451426872 (2012/05/22 15:27:03)
          Receive Timestamp:    3547953212.622200572 (2012/06/06 14:33:32)
          Transmit Timestamp:   3547953212.622218973 (2012/06/06 14:33:32)
            Originator - Receive Timestamp:  +1292789.170773700
            Originator - Transmit Timestamp: +1292789.170792100
15:27:07.419467 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 76)
    172.18.110.101.ntp > 114.80.81.1.ntp: [bad udp cksum aebc!] NTPv4, length 48
        Client, Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 6s, precision -19
        Root Delay: 0.000000, Root dispersion: 0.003952, Reference-ID: (unspec)
          Reference Timestamp:  0.000000000
          Originator Timestamp: 3547953151.380723113 (2012/06/06 14:32:31)
          Receive Timestamp:    3546660362.573881259 (2012/05/22 15:26:02)
          Transmit Timestamp:   3546660427.419453041 (2012/05/22 15:27:07)
            Originator - Receive Timestamp:  -1292788.806841853
            Originator - Transmit Timestamp: -1292723.961270072
15:27:07.575183 IP (tos 0x0, ttl 46, id 29686, offset 0, flags [none], proto UDP (17), length 76)
    114.80.81.1.ntp > 172.18.110.101.ntp: [udp sum ok] NTPv4, length 48
        Server, Leap indicator:  (0), Stratum 2 (secondary reference), poll 6s, precision -19
        Root Delay: 0.141281, Root dispersion: 0.014022, Reference-ID: clock.isc.org
          Reference Timestamp:  3547953071.150161125 (2012/06/06 14:31:11)
          Originator Timestamp: 3546660427.419453041 (2012/05/22 15:27:07)
          Receive Timestamp:    3547953216.384588356 (2012/06/06 14:33:36)
          Transmit Timestamp:   3547953216.384617924 (2012/06/06 14:33:36)
            Originator - Receive Timestamp:  +1292788.965135315
            Originator - Transmit Timestamp: +1292788.965164883
14:33:53.467969 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 76)
    172.18.110.101.ntp > 114.80.81.1.ntp: [bad udp cksum 2535!] NTPv4, length 48
        Client, Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 6s, precision -19
        Root Delay: 0.000000, Root dispersion: 0.000244, Reference-ID: (unspec)
          Reference Timestamp:  0.000000000                                                                                                        -->客户端已经完成时间调整
          Originator Timestamp: 0.000000000
          Receive Timestamp:    0.000000000
          Transmit Timestamp:   3547953233.467953163 (2012/06/06 14:33:53)
            Originator - Receive Timestamp:  0.000000000
            Originator - Transmit Timestamp: 3547953233.467953163 (2012/06/06 14:33:53)
14:33:53.623376 IP (tos 0x0, ttl 46, id 41881, offset 0, flags [none], proto UDP (17), length 76)
    114.80.81.1.ntp > 172.18.110.101.ntp: [udp sum ok] NTPv4, length 48
        Server, Leap indicator:  (0), Stratum 2 (secondary reference), poll 6s, precision -19
        Root Delay: 0.141281, Root dispersion: 0.014282, Reference-ID: clock.isc.org
          Reference Timestamp:  3547953071.150161125 (2012/06/06 14:31:11)
          Originator Timestamp: 3547953233.467953163 (2012/06/06 14:33:53)
          Receive Timestamp:    3547953233.546174910 (2012/06/06 14:33:53)
          Transmit Timestamp:   3547953233.546201410 (2012/06/06 14:33:53)
            Originator - Receive Timestamp:  +0.078221747
            Originator - Transmit Timestamp: +0.078248247
14:34:01.462939 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 76)
    172.18.110.101.ntp > 216.45.57.38.ntp: [bad udp cksum 9328!] NTPv4, length 48
        Client, Leap indicator: clock unsynchronized (192), Stratum 0 (unspecified), poll 6s, precision -19
        Root Delay: 0.000000, Root dispersion: 0.000366, Reference-ID: (unspec)
          Reference Timestamp:  0.000000000
          Originator Timestamp: 0.000000000
          Receive Timestamp:    0.000000000
          Transmit Timestamp:   3547953241.462924544 (2012/06/06 14:34:01)
            Originator - Receive Timestamp:  0.000000000
            Originator - Transmit Timestamp: 3547953241.462924544 (2012/06/06 14:34:01)
14:34:01.722198 IP (tos 0x0, ttl 49, id 18438, offset 0, flags [none], proto UDP (17), length 76)
    216.45.57.38.ntp > 172.18.110.101.ntp: [udp sum ok] NTPv4, length 48
        Server, Leap indicator:  (0), Stratum 2 (secondary reference), poll 6s, precision -19
        Root Delay: 0.009826, Root dispersion: 0.025421, Reference-ID: clock.sjc.he.net
          Reference Timestamp:  3547952884.102668383 (2012/06/06 14:28:04)
          Originator Timestamp: 3547953241.462924544 (2012/06/06 14:34:01)
          Receive Timestamp:    3547953241.612733928 (2012/06/06 14:34:01)
          Transmit Timestamp:   3547953241.612783601 (2012/06/06 14:34:01)
            Originator - Receive Timestamp:  +0.149809383
            Originator - Transmit Timestamp: +0.149859056
以下命令在抓包的同时在另一个终端上运行
[root@centos6 logs]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 mail.melancthon 209.51.161.238   2 u    3   64    1  374.339  1292788   0.002
 216.45.57.38    216.218.254.202  2 u    2   64    1  277.786  1292788   0.002
 114.80.81.1     204.152.184.72   2 u    1   64    1  155.659  1292788   0.002
[root@centos6 logs]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 mail.melancthon 209.51.161.238   2 u   10   64    1  374.339  1292788   0.002
 216.45.57.38    216.218.254.202  2 u    9   64    1  277.786  1292788   0.002
 114.80.81.1     204.152.184.72   2 u    8   64    1  155.659  1292788   0.002
[root@centos6 logs]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 mail.melancthon 209.51.161.238   2 u   24   64    1  374.339  1292788   0.002
 216.45.57.38    216.218.254.202  2 u   23   64    1  277.786  1292788   0.002
 114.80.81.1     204.152.184.72   2 u   22   64    1  155.659  1292788   0.002
[root@centos6 logs]# date
2012年 05月 22日 星期二 15:23:15 CST
[root@centos6 logs]# date
2012年 05月 22日 星期二 15:25:00 CST
[root@centos6 ~]# date
2012年 05月 22日 星期二 15:26:58 CST
[root@centos6 ~]# date                                                               -->现在还是错误的时间,运行完这条命令后时间就已经自动修改正过来了
2012年 05月 22日 星期二 15:27:04 CST
[root@centos6 ~]# ntpq -p                                                          -->与服务器已经没有时间差了
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 mail.melancthon .STEP.          16 u 1975   64    0    0.000    0.000   0.002
 216.45.57.38    .STEP.          16 u  343   64    0    0.000    0.000   0.002
 114.80.81.1     .STEP.          16 u  156   64    0    0.000    0.000   0.002
[root@centos6 ~]# date
2012年 06月 06日 星期三 14:33:59 CST                                  -->再看时间已经是正确的了
[root@centos6 ~]# date
2012年 06月 06日 星期三 14:34:01 CST

你可能感兴趣的:(工作,Date,server,centos,reference,delay)