注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 利用手机和电池实现反地心..
 帮助

NTP (network time protocol)


2007-01-04 06:46:04
 标签:路由 NTP   [推送到技术圈]

版权声明:原创作品,谢绝转载!否则将追究法律责任。
      
                SW1 F0/0-------------------------F0/0 SW2
配置NTP,使两台交换机的时钟同步。其中SW1为SERVER端,SW2为CLIENT端
初始配置
SW1:
conf t
int f 0/0
no switchport
ip ad 10.1.1.1 255.255.255.0
no shut
end

SW2
conf t
int f 0/0
no switchport
ip ad 10.1.1.2 255.255.255.0
no shut
end
开始配置NTP
sw1
conf t
ntp authenticate                                /启用NTP验证
ntp authentication-key 8 md5 CCIE       /设置NTP验证码为CCIE
ntp trusted-key 8                               /防止意外的同步发生
ntp master                                 /设置master交换机,master值默认为8,范围 1~15。此命令只需在SERVER上配置
ntp peer 10.1.1.2  key 8                     /对端为CLIENT,与对端交换机建立关联
exit

SW2
conf t
ntp authenticate
ntp authentication-key 8 md5 CCIE
ntp truster-key 8
ntp server 10.1.1.1 key 8                    /对端为SERVER,与对端交换机建立关联
exit

校验
sw1#sh ntp s
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 CC468192.A7EE6D49 (08:25:54.655 UTC Fri Aug 8 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

SW2#sh ntp s
Clock is synchronized, stratum 9, reference is 10.1.1.1
nominal freq is 250.0000 Hz, actual freq is 250.0001 Hz, precision is 2**18
reference time is CC468263.D88EF525 (08:29:23.845 UTC Fri Aug 8 2008)
clock offset is -61.8452 msec, root delay is 183.73 msec
root dispersion is 15936.90 msec, peer dispersion is 15875.02 msec
目前两端交换机已同步

进入SW1的特权模式,输入命令
clock set 6:40:10 4 january 2007
sw1#sh ntp s                       
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**24
reference time is C9472369.CFDE1E75 (06:55:37.811 UTC Thu Jan 4 2007)
clock offset is 0.0000 msec, root delay is 0.00 msec
root dispersion is 0.02 msec, peer dispersion is 0.02 msec

来看SW2的校验
sw2#sh ntp s
Clock is unsynchronized, stratum 16, no reference clock
nominal freq is 250.0000 Hz, actual freq is 249.9997 Hz, precision is 2**18
reference time is CC468723.B9593587 (08:49:39.724 UTC Fri Aug 8 2008)
clock offset is 17.8636 msec, root delay is 51.80 msec
root dispersion is 53.50 msec, peer dispersion is 35.61 msec
现在是没有同步的,因为在SW1上刚做了新的时间配置,
在SW2上输入 show run | include clock-period命令
SW2#sh run | include clock-period
ntp clock-period 17179889               /17179889表示SW2更新时钟的时间间隔。单位是MS
过一段时间后再在SW2上输入 sh ntp status
SW2#sh ntp s
Clock is synchronized, stratum 9, reference is 10.1.1.1
nominal freq is 250.0000 Hz, actual freq is 249.9997 Hz, precision is 2**18
reference time is C9472162.E919F71E (06:46:58.910 UTC Thu Jan 4 2007)
clock offset is 3.6307 msec, root delay is 131.81 msec
root dispersion is 8258.48 msec, peer dispersion is 7879.84 msec
表明时钟已和SW1同步

本文出自 “穿过地狱去看海” 博客,谢绝转载!





    文章评论
 
2007-01-04 10:27:26
thanks !

2007-01-11 17:12:29
师兄~~~~~我来看你的博客了~~~~

2007-02-07 01:51:30
乖乖,时间一样还这么麻烦。。。

2007-03-11 11:16:52
想问问,为什么在路由器上设置了主时间服务器后stratum就是8,能否作修改?
有些peer是stratum9,有的是stratum10

2007-03-11 15:28:42
SERVER上配置的MASETER默认值为8。如果你在SERVER上设置的MASTER的值更小的话,PEER上的值就会变化,直接改好像不可以
另,有的交换机或者路由器并不是直接和SERVER连接的,如果同处于一个广播域,STRATUM就会一样。如果路由器或交换机在更下一级,STRATUM就会自动增加,一直到15

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: