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同步