1 交换机配置
 
// 配置CISCO 设备当前日期及时区
SW#
SW#conf t
SW(config)#clock timezone GMT +8
SW(config-if)#end
SW#clock set 11:05:00 8 apr 2009
 
// 配置接口IP,以实现与NTP服务器通信
SW#
SW#conf t
SW(config)#int f0/0
SW(config-if)#ip add 192.168.0.69 255.255.255.0
SW(config-if)#no shutdown
SW(config-if)#end
SW#
 
 
 
// 配置NTP Client,并指定NTP服务器
SW#
SW#conf t
SW(config)#service timestamps log datetime localtime
SW(config)#service timestamps debug datetime localtime
SW(config)#ntp server 192.168.0.168
SW(config)#ntp update-calendar // 如果有硬件时钟,同步设备硬件时钟
SW(config)#end
SW#
 
// 查询同步结果, 已经实现了同步
SW#show ntp status
Clock is synchronized, stratum 3, reference is 192.168.0.168
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**18
reference time is CD86975A.71DD2468 (11:24:10.444 GMT Wed Apr 8 2009)
clock offset is -0.1861 msec, root delay is 87.49 msec
root dispersion is 44.14 msec, peer dispersion is 6.87 msec
SW#
SW#show ntp associations
 
      address         ref clock     st  when  poll reach  delay  offset    disp
*~192.168.0.168    210.72.145.44     2    43    64  377    12.1   -9.25    11.0
 * master (synced), # master (unsynced), + selected, - candidate, ~ configured
 
SW#show clock       
11:26:20.286 GMT Wed Apr 8 2009
SW#show clock detail
11:26:25.186 GMT Wed Apr 8 2009
Time source is NTP
SW#
 
(2) 路由器配置
 
// 配置CISCO 设备当前日期及时区
Router#
Router#conf t
Router(config)#clock timezone GMT +8
Router(config)#en
Router#clock set 11:28:00 8 apr 2009
 
// 配置接口IP,以实现与NTP服务器通信
Router#
Router#conf t
Router(config)#int f0/0
Router(config-if)#ip add 192.168.0.70 255.255.255.0
Router(config-if)#no shutdown
 
// 配置NTP Client,并指定NTP服务器
Router#
Router#conf t
Router(config)#ntp server 192.168.0.168
Router(config)#ntp update-calendar // 如果有硬件时钟,同步设备硬件时钟
Router(config)#end
Router#
 
// 查询同步结果, 已经实现了同步
Router#show ntp status
Clock is synchronized, stratum 14, reference is 192.168.0.168
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**18
reference time is CD869958.18F04EA3 (11:32:40.097 GMT Wed Apr 8 2009)
clock offset is 0.0124 msec, root delay is 8.30 msec
root dispersion is 15886.52 msec, peer dispersion is 15875.02 msec
 
Router#show ntp associations
      address         ref clock     st  when  poll reach  delay  offset    disp
*~192.168.0.168    127.127.1.0      13     0    64  177     4.2    0.63   126.0
 * master (synced), # master (unsynced), + selected, - candidate, ~ configured
 
Router#show clock
11:32:50.593 GMT Wed Apr 8 2009
 
Router#show clock detail
11:32:58.405 GMT Wed Apr 8 2009
Time source is NTP