
NTP:Network Time Protocol
网络时间协议(NTP)是一种通过因特网服务于计算机时钟的时间同步协议。它提供了一种同步时间机制,能在庞大而复杂多样的因特网中用光速调整时间分配。它使用的是可返回时间设计,分布式子网内的时间服务器,能自我组织操作、分层管理配置,经过有线或无线方式同步子网内的逻辑时钟达到国家标准时间。此外,通过本地路由选择运算法则及时间后台程序,服务器可以重新分配标准时间。
实验过程: 第一步 R1、R2、R3的预配置 R1(config)#int s2/1 R1(config-if)#ip add 192.168.0.1 255.255.255.0 R1(config-if)#no sh R1(config-if)#exit
R2(config)#int s2/1 R2(config-if)#ip add 192.168.0.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#int s2/2 R2(config-if)#ip add 172.16.0.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#exit
R3(config)#int s2/1 R3(config-if)#ip add 172.16.0.3 255.255.255.0 R3(config-if)#no sh R3(config-if)#exit
第二步 配置NTP Master R1#show clock 10:31:05.651 UTC Sun Jun 29 2008 // 查看R1上的时钟,可以使用clock set进行调整 R1#conf t R1(config)#ntp master // 将R1配置为ntp master R1(config)#end
R1#show ntp status Clock is synchronized, stratum 8, reference is 127.127.7.1 nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**18 reference time is CC11E2FD.A8FE7917 (10:31:25.660 UTC Sun Jun 29 2008) clock offset is 0.0000 msec, root delay is 0.00 msec root dispersion is 125.02 msec, peer dispersion is 125.02 msec R1#
第三步 将R2配置为NTP Client R2(config)#ntp server 192.168.0.1 R2(config)#end
第四步 查看R2的NTP配置 R2#show ntp associations
address ref clock st when poll reach delay offset disp ~192.168.0.1 127.127.7.1 8 0 64 0 108.1 483791 16000. * master (synced), # master (unsynced), + selected, - candidate, ~ configured R2#show ntp associations detail 192.168.0.1 configured, our_master, sane, valid, stratum 8 ref ID 127.127.7.1, time CC11E306.A8F7CCD9 (10:31:34.660 UTC Sun Jun 29 2008) our mode client, peer mode server, our poll intvl 64, peer poll intvl 64 root delay 0.00 msec, root disp 0.03, reach 377, sync dist 16.357 delay 19.96 msec, offset 14.3809 msec, dispersion 6.35 precision 2**18, version 3 org time CC11E32B.1EC7BF8B (10:32:11.120 UTC Sun Jun 29 2008) rcv time CC11E32B.1E609822 (10:32:11.118 UTC Sun Jun 29 2008) xmt time CC11E32B.10006453 (10:32:11.062 UTC Sun Jun 29 2008) filtdelay = 56.14 27.97 52.15 52.15 124.18 24.14 19.96 140.20 filtoffset = 29.65 7.70 15.63 19.52 19.12 20.73 14.38 -33.88 filterror = 0.02 0.03 0.05 0.06 0.08 0.09 0.11 0.12
第五步 配置R2与R3采用NTP认证 R2#conf t R2(config)#ntp authenticate R2(config)#ntp authentication-key 1 md5 cisco R2(config)#ntp trusted-key 1
R3(config)#ntp authenticate R3(config)#ntp authentication-key 1 md5 cisco R3(config)#ntp trusted-key 1 R3(config)#ntp peer 172.16.0.2
第六步 查看NTP的配置 R1#show ntp associations detail 127.127.7.1 configured, our_master, sane, valid, stratum 7 ref ID 127.127.7.1, time CC11E406.A8F675E0 (10:35:50.660 UTC Sun Jun 29 2008) our mode active, peer mode passive, our poll intvl 64, peer poll intvl 64 root delay 0.00 msec, root disp 0.00, reach 377, sync dist 0.015 delay 0.00 msec, offset 0.0000 msec, dispersion 0.02 precision 2**18, version 3 org time CC11E406.A8F675E0 (10:35:50.660 UTC Sun Jun 29 2008) rcv time CC11E406.A8F675E0 (10:35:50.660 UTC Sun Jun 29 2008) xmt time CC11E406.A8F65452 (10:35:50.660 UTC Sun Jun 29 2008) filtdelay = 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 filtoffset = 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 filterror = 0.02 0.99 1.97 2.94 3.92 3.94 3.95 3.97 Reference clock status: Running normally Timecode:
R1#show ntp status Clock is synchronized, stratum 8, reference is 127.127.7.1 nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**18 reference time is CC11E486.A8F5F0A3 (10:37:58.660 UTC Sun Jun 29 2008) clock offset is 0.0000 msec, root delay is 0.00 msec root dispersion is 0.02 msec, peer dispersion is 0.02 msec R1#
R2#show ntp association detail 192.168.0.1 configured, our_master, sane, valid, stratum 8 ref ID 127.127.7.1, time CC11E486.A8F5F0A3 (10:37:58.660 UTC Sun Jun 29 2008) our mode client, peer mode server, our poll intvl 64, peer poll intvl 64 root delay 0.00 msec, root disp 0.03, reach 377, sync dist 34.042 delay 27.97 msec, offset 7.6974 msec, dispersion 20.03 precision 2**18, version 3 org time CC11E4AB.20CE4A82 (10:38:35.128 UTC Sun Jun 29 2008) rcv time CC11E4AB.35DDBBEB (10:38:35.210 UTC Sun Jun 29 2008) xmt time CC11E4AB.1303E5CD (10:38:35.074 UTC Sun Jun 29 2008) filtdelay = 136.12 176.12 108.12 108.14 148.13 48.13 56.14 27.97 filtoffset = -14.20 -16.85 -9.63 -16.35 -12.92 15.29 29.65 7.70 filterror = 0.02 0.99 1.97 2.94 3.92 4.90 5.87 5.89
R2#show ntp status Clock is synchronized, stratum 9, reference is 192.168.0.1 nominal freq is 250.0000 Hz, actual freq is 249.9997 Hz, precision is 2**18 reference time is CC11E4AB.35DDBBEB (10:38:35.210 UTC Sun Jun 29 2008) clock offset is 7.6974 msec, root delay is 27.97 msec root dispersion is 27.76 msec, peer dispersion is 20.03 msec R2#
R3#show ntp associations detail 172.16.0.2 configured, our_master, sane, valid, stratum 9 ref ID 192.168.0.1, time CC11E4AB.35DDBBEB (10:38:35.210 UTC Sun Jun 29 2008) our mode active, peer mode passive, our poll intvl 64, peer poll intvl 64 root delay 27.97 msec, root disp 27.77, reach 377, sync dist 69.199 delay 20.16 msec, offset 21.9157 msec, dispersion 17.36 precision 2**18, version 3 org time CC11E4C5.ACD5C265 (10:39:01.675 UTC Sun Jun 29 2008) rcv time CC11E4C5.A977D83D (10:39:01.661 UTC Sun Jun 29 2008) xmt time CC11E4C5.A13C73C5 (10:39:01.629 UTC Sun Jun 29 2008) filtdelay = 32.10 148.13 148.13 124.19 116.24 20.16 104.17 72.17 filtoffset = 29.21 17.41 -4.34 21.70 25.95 21.92 27.94 59.78 filterror = 0.02 0.99 1.97 2.94 2.96 2.98 2.99 3.01
R3#show ntp status Clock is synchronized, stratum 10, reference is 172.16.0.2 nominal freq is 250.0000 Hz, actual freq is 249.9997 Hz, precision is 2**18 reference time is CC11E4C5.A977D83D (10:39:01.661 UTC Sun Jun 29 2008) clock offset is 21.9157 msec, root delay is 48.13 msec root dispersion is 67.05 msec, peer dispersion is 17.36 msec R3#
|