分类: 系统运维
2012-12-19 12:55:41
NTP 同步协议配置
Tags: NTP, 时间同步, 实验, 协议
时间同步对于大的中是必须的。用来排错时看日志用的。
R1 --------- R2---------- R3(Server)
R1:
clock timezone CHINA 8// 时区
interface Serial1/1
ip address 172.16.1.1 255.255.0.0
ntp broadcast client 配置本地路由器为NTP客户端,接受NTP的时间广播信息来配置本地时间
router rip
network 172.16.0.0
ntp server 192.168.1.3 // 指定服务器IP
R2:
clock timezone CHINA 8// 时区
interface Serial1/1
ip address 172.16.1.2 255.255.0.0
interface Serial1/3
ip address 192.168.1.2 255.255.255.0
ntp broadcast client 配置本地路由器为NTP客户端,接受NTP的时间广播信息来配置本地时间
router rip
network 172.16.0.0
network 192.168.1.0
ntp authentication-key 1 md5 cisco
ntp authenticate
ntp server 192.168.1.3
R3:
interface Serial1/3
ip address 192.168.1.3 255.255.255.0
router rip
network 192.168.1.0
clock timezone CHINA 8// 时区
ntp authentication-key 1 md5 cisco
ntp authenticate
ntp source Serial1/2 配置NTP与NTP通信的源地址
ntp master 配置自身为权威的NTP服务器
实验结果:
R1#sh clock
00:07:51.242 UTC Mon Mar 1 1993
R2#sh clock
*00:03:09.359 UTC Mon Mar 1 1993
在R3上设置:
R3#clock set 13:34:50 sep 27 2008
过几分钟(NTP协议收敛很慢,大的网络可能要等上半个---一个小时)
R1#sh clock
13:44:54.692 UTC Sat Sep 27 2008
R2#sh clock
13:44:46.638 UTC Sat Sep 27 2008
R1#sh ntp status
Clock is synchronized, stratum 9, reference is 192.168.1.3
nominal freq is 250.0000 Hz, actual freq is 249.9999 Hz, precision is 2**18
reference time is CC88B769.D3212DD4 (13:45:13.824 UTC Sat Sep 27 2008)
clock offset is -40.5541 msec, root delay is 15.95 msec
root dispersion is 1967.65 msec, peer dispersion is 1927.06 msec
R2#sh ntp status
Clock is synchronized, stratum 9, reference is 192.168.1.3
nominal freq is 250.0000 Hz, actual freq is 249.9989 Hz, precision is 2**18
reference time is CC88C252.CDB8FCFF (14:31:46.803 UTC Sat Sep 27 2008)
clock offset is -48.3540 msec, root delay is 15.93 msec
root dispersion is 77.47 msec, peer dispersion is 29.08 msec
相应的查看与调试命令:
show clock detail
show ntp associations
show ntp status
debug ntp packets
debug ntp authentications
可在客户端没用的接口关闭NTP服务。ntp disable