NTP(NetworkTimeProtocol,网络时间协议)是基于RFC1305的协议,是一个跨越广域网或局域网的复杂的同步时间协议。一般情况下建议配置在路由器上,当然配置在其它设备上都是可以的。接下来我们根据下面的拓扑图来看一下在路由器上配置NTP服务器的方法以及交换机、windows服务器、Linux服务器如何设置NTP客户端。拓扑如下:
路由器NTPserver上配置如下:
R1>en
R1#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
R1(config)#hostnameNTPserver
NTPserver(config)#noipdolo
NTPserver(config)#linecon0
NTPserver(config-line)#exec-t00
NTPserver(config-line)#loggsyn
NTPserver(config-line)#exit
NTPserver(config)#inte0/1
NTPserver(config-if)#inte0/0
NTPserver(config-if)#exi
NTPserver(config)#inte0/0
NTPserver(config-if)#ipad192.168.1.1255.255.255.0
NTPserver(config-if)#noshut
NTPserver(config-if)#
*Mar100:02:39.959:%LINK-3-UPDOWN:InterfaceEthernet0/0,changedstatetoup
*Mar100:02:40.959:%LINEPROTO-5-UPDOWN:LineprotocolonInterfaceEthernet0/0,changedstatetoup
NTPserver(config-if)#clocktime
NTPserver(config-if)#dowr
Buildingconfiguration...
[OK]
NTPserver(config-if)#exit
NTPserver(config)#cloc
NTPserver(config)#clocktime
NTPserver(config)#clocktimezonepeking+8
NTPserver(config)#
*Mar100:03:27.019:%SYS-6-CLOCKUPDATE:Systemclockhasbeenupdatedfrom00:03:27UTCFriMar12002to08:03:27pekingFriMar12002,configuredfromconsolebyconsole.
NTPserver(config)#exit
NTPserver#
*Mar100:04:02.975:%SYS-5-CONFIG_I:Configuredfromconsolebyconsole
NTPserver#cloc
NTPserver#clockset12:02:206Aug
NTPserver#
*Aug604:02:20.003:%SYS-6-CLOCKUPDATE:Systemclockhasbeenupdatedfrom08:04:45pekingFriMar12002to12:02:20pekingMonAug6,configuredfromconsolebyconsole.
NTPserver#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
NTPserver(config)#ntpmaster