Lab 3-2: Network Time Protocol
Figure 3-3. Topology Diagram
Equipment Required
This lab uses the following equipment:
- Cisco router (and a second Cisco router if Internet access is not allowed from the first router)
- Switch that supports voice VLANs
Learning Objectives
Upon completion of this lab, you will be able to configure Network Time Protocol (NTP).
Scenario
SOI wants its new data network to use NTP to synchronize time for network devices.
NTP is not only important for synchronizing the time in network device event logs, but also for VoIP to show the correct time on the display of the phones and record the correct timestamp on voicemails, among other uses. The best way to keep everything synchronized is to use an NTP server to coordinate time.
This lab has instructions for two options:
- Option A assumes access to a production network that can reach an NTP server on the Internet.
- Option B configures another Cisco router to provide NTP time to simulate an Internet NTP server.
These instructions refer to the Pod Addressing Table in Appendix A to determine the IP addresses and VLAN numbers used for your pod. Wherever an x is shown, substitute the pod number.
Task 1: NTP Services
Step 1-1: Load Prior Configurations
Use the configuration from Lab 3-1. If necessary, load the configuration for both the switch and router.
Step 1-2: (Optional) Configure Local Time Zone
NTP is calculated using UTC (Greenwich Mean Time), but you might want to see the time displayed on the router and phones using your local time zone.
RtrPodx(config)# clock timezone timezone offset-from-GMT
For example, U.S. Central Daylight Time would use clock timezone cdt -6.
RtrPodx(config)# clock summer-time zone recurring
For example, U.S. Central Daylight Time would use clock summer-time cdt recurring.
Step 1-3: Manually Set the Clock
By manually setting the clock close to the correct time, you reduce the amount of time it takes to synchronize with the NTP server. Ideally, you should be within a minute or two of the correct time.
Use the privileged EXEC mode command clock set to manually set time:
RtrPodx# clock set hh:mm:ss day month year
For example, if the current day is Thursday, August 16, 2012 and the time is 9:40 p.m., you would enter clock set 21:40:00 16 August 2012.
Step 1-4 (Option A): Contact an NTP Server on the Internet
(Proceed to Step 1-4 [Option B] if you do not have access to the Internet.)
Configure an interface on the router to reach the Internet. The commands in this step assume that Fast Ethernet 0/1 is cabled to a production network with Internet access and a DHCP server that will assign IP addresses to the router.
RtrPodx(config)# interface fastethernet 0/1 RtrPodx(config-if)# ip address dhcp RtrPodx(config-if)# no shutdown RtrPodx(config-if)# exit RtrPodx(config)# ip route 0.0.0.0 0.0.0.0 gateway-of-Fa0/1-network
A list of NTP stratum two servers can be found at www.ntp.org (http://support.ntp.org/bin/view/Servers/StratumTwoTimeServers). After selecting one close to you, use the ntp server command:
RtrPodx(config)# ntp server ntp_server_IP_address
Skip Step 1-4 (Option B) and go to Step 1-5 to verify NTP operation.
Step 1-4 (Option B): Configure Another Cisco Router to Act as an NTP Server
(Skip this step if you completed Option A.)
The commands in this step assume that Fast Ethernet 0/1 on the voice router is cabled to another Cisco router. (A serial interface could also be used, but the Ethernet interfaces do not require any additional hardware.)
First, configure the other router to connect to the voice router.
Router(config)# hostname NTP_Server NTP_Server(config)# interface fastethernet 0/0 NTP_Server(config-if)# ip address 192.168.0.1 255.255.255.0 NTP_Server(config-if)# no shutdown NTP_Server(config-if)# exit
Set the time zones and clock on the NTP_Server router to match the VoIP router (as you did in Steps 1-2 and 1-3).
NTP_Server(config)# clock timezone timezone offset-from-GMT NTP_Server(config)# clock summer-time zone recurring NTP_Server# clock set hh:mm:ss day month year
Because you are configuring a “fake” NTP server, it is best to use a higher NTP stratum number to avoid conflicting with real NTP servers. Configure the NTP_Server router to be an NTP time source with the ntp master stratum number command.
NTP_Server(config)# ntp master 4
Configure the VoIP router to connect to the NTP_Server router.
RtrPodx(config)# interface fastethernet 0/1 RtrPodx(config-if)# ip address 192.168.0.2 255.255.255.0 RtrPodx(config-if)# no shutdown RtrPodx(config-if)# exit RtrPodx(config)# ntp server 192.168.0.1 RtrPodx(config)# end
Go to Step 1-5 to verify NTP operation.
Step 1-5: Verify That the Time Is Synchronized
Use the following commands to verify that NTP is working:
RtrPodx# show ntp status RtrPodx# show ntp association RtrPodx# show ntp association detail
In Examples 3-2a to 3-2g, the Pod 11 router is shown acquiring NTP time from another router. Your results will vary, but the descriptions will help you understand the various outputs you might see as the router uses NTP to synchronize.
The show ntp associations command output start with an “INIT” as the status, while the show ntp associations detail command output shows the server as “insane, invalid, unsynced” and the filter error is 16 (showing no polling data).
Example 3-2a. Output Showing Pod 11 Router Acquiring NTP Time
RtrPod11# show ntp associations address ref clock st when poll reach delay offset disp ~192.168.0.1.INIT.
16 - 64 0 0.000 0.000 16000. * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured RtrPod11# show ntp associations detail 192.168.0.1 configured,insane, invalid, unsynced,
stratum 16 ref ID.INIT.
, time 00000000.00000000 (18:00:00.000 CDT Thu Dec 31 1899) our mode client, peer mode unspec, our poll intvl 64, peer poll intvl 1024 root delay 0.00 msec, root disp 0.00, reach 0, sync dist 16.00 delay 0.00 msec, offset 0.0000 msec, dispersion 16000.00 precision 2**24, version 4 org time 00000000.00000000 (18:00:00.000 CDT Thu Dec 31 1899) rec time 00000000.00000000 (18:00:00.000 CDT Thu Dec 31 1899) xmt time 00000000.00000000 (18:00:00.000 CDT Thu Dec 31 1899) filtdelay = 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 filtoffset = 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 filterror =16.00 16.00 16.00 16.00 16.00 16.00 16.00 16.00
minpoll = 6, maxpoll = 10
After the INIT phase is done (which can take a minute), the router shows the difference between the NTP server time and the time on the router. The router is now establishing the variation in time between the received time and local time. At the point the incrementing “when” counter equals the “poll” number, the NTP server will be queried again.
Example 3-2b. Output Showing Pod 11 Router Acquiring NTP Time
RtrPod11# show ntp associations address ref clock st when poll reach delay offset disp ~192.168.0.1 127.127.1.1 1011
64
1 0.000 -348980 7937.5 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured RtrPod11# show ntp associations address ref clock st when poll reach delay offset disp ~192.168.0.1 127.127.1.1 1044
64
1 0.000 -348980 7937.5 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
In Example 3-2c, the router is 3,489.807 seconds off from the NTP server time. This phase will take several minutes.
Example 3-2c. Output Showing Pod 11 Router Acquiring NTP Time
RtrPod11# show ntp associations detail 192.168.0.1 configured, insane, invalid, stratum 10 ref ID 127.127.1.1 , time D22D35B2.32265329 (00:57:06.195 CDT Wed Sep 28 2011) our mode client, peer mode server, our poll intvl 64, peer poll intvl 64 root delay 0.00 msec,root disp 0.30
, reach 1, sync dist 7.94 delay 0.00 msec,offset -3489807.6733 msec
, dispersion 7937.50 precision 2**24, version 4 org time D22D35B8.CB5A7071 (00:57:12.794 CDT Wed Sep 28 2011) rec time D22D435A.9A57C7DE (01:55:22.602 CDT Wed Sep 28 2011) xmt time D22D435A.99DE9D3F (01:55:22.601 CDT Wed Sep 28 2011) filtdelay = 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 filtoffset =-3489.8
0.00 0.00 0.00 0.00 0.00 0.00 0.00 filterror =0.00
16.00 16.00 16.00 16.00 16.00 16.00 16.00 minpoll = 6, maxpoll = 10
The next phase is to accept the time from the NTP server and establish the accuracy of the local clock. Notice that the router is just over 2 milliseconds off from the NTP server. The “filteroffset” and “filtererror” are now 0 for the first poll.
Example 3-2d. Output Showing Pod 11 Router Acquiring NTP Time
RtrPod11# show ntp associations detail 192.168.0.1 configured, insane, invalid, stratum 10 ref ID 127.127.1.1 , time D22D36A0.3225413B (01:01:04.195 CDT Wed Sep 28 2011) our mode client, peer mode server, our poll intvl 64, peer poll intvl 64 root delay 0.00 msec, root disp 0.21, reach 1, sync dist 7.94 delay 0.00 msec,offset 2.2946
msec, dispersion 7937.50 precision 2**24, version 4 org time D22D36A0.CC349A2D (01:01:04.797 CDT Wed Sep 28 2011) rec time D22D36A0.CBD66632 (01:01:04.796 CDT Wed Sep 28 2011) xmt time D22D36A0.CB603CB8 (01:01:04.794 CDT Wed Sep 28 2011) filtdelay = 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 filtoffset =0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 filterror =0.00
16.00 16.00 16.00 16.00 16.00 16.00 16.00 minpoll = 6, maxpoll = 10
Every 64 seconds, the router polls the NTP server again. You can see the polls show up, as the “filtererror” is gradually set to 0 for each new poll.
Example 3-2e. Output Showing Pod 11 Router Acquiring NTP Time
RtrPod11# show ntp associations 192.168.0.1 configured, insane, invalid, stratum 10 ref ID 127.127.1.1 , time D22D36D2.32254796 (01:01:54.195 CDT Wed Sep 28 2011) our mode client, peer mode server, our poll intvl 64, peer poll intvl 64 root delay 0.00 msec, root disp 0.44, reach 3, sync dist 3.94 delay 0.00 msec, offset 3.1598 msec, dispersion 3937.73 precision 2**24, version 4 org time D22D36DF.CC672189 (01:02:07.798 CDT Wed Sep 28 2011) rec time D22D36DF.CBD02AD0 (01:02:07.796 CDT Wed Sep 28 2011) xmt time D22D36DF.CB5A1A5B (01:02:07.794 CDT Wed Sep 28 2011) filtdelay = 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 filtoffset = 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 filterror =0.00
0.00
16.00 16.00 16.00 16.00 16.00 16.00 minpoll = 6, maxpoll = 10
After enough polls have been completed, the time on the router is NTP synchronized. Your router now considers the NTP server “our master, sane, and valid.”
Example 3-2f. Output Showing Pod 11 Router Acquiring NTP Time
RtrPod11# show ntp associations detail
192.168.0.1 configured, our_master, sane, valid, stratum 10
ref ID 127.127.1.1 , time D22D3756.32286702 (01:04:06.195 CDT Wed Sep 28 2011)
our mode client, peer mode server, our poll intvl 64, peer poll intvl 64
root delay 0.00 msec, root disp 0.39, reach 17, sync dist 0.94
delay 0.00 msec, offset 3.1598 msec, dispersion 939.24
precision 2**24, version 4
org time D22D3760.CCE2CF70 (01:04:16.800 CDT Wed Sep 28 2011)
rec time D22D3760.CBD604CE (01:04:16.796 CDT Wed Sep 28 2011)
xmt time D22D3760.CB5F51F8 (01:04:16.794 CDT Wed Sep 28 2011)
filtdelay = 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
filtoffset = 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
filterror = 0.00 0.00 0.00 0.00 16.00 16.00 16.00 16.00
minpoll = 6, maxpoll = 10
The asterisk (*) in front of the NTP server IP address shows that the server is synchronized. The show ntp status command also shows that the server is synchronized.
Example 3-2g. Output Showing Pod 11 Router Acquiring NTP Time
RtrPod11# show ntp associations address ref clock st when poll reach delay offset disp*
~192.168.0.1 127.127.1.1 10 21 64 377 0.000 15.598 4.689* sys.peer,
# selected, + candidate, - outlyer, x falseticker, ~ configured RtrPod11# show ntp statusClock is synchronized
, stratum 11, reference is 192.168.0.1 nominal freq is 250.0000 Hz, actual freq is 249.9998 Hz, precision is 2**24 reference time is D22D3760.CBD604CE (01:04:16.796 CDT Wed Sep 28 2011) clock offset is 0.0031 msec, root delay is 0.00 msec root dispersion is 0.94 msec, peer dispersion is 0.44 msec loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000000722 s/s system poll interval is 64, last update was 99 sec ago.
Step 1-6: (Optional) Configure the Switch to Get NTP from the Router
For the sake of making sure that all networking devices are synchronized using NTP, the switch should use the router as an NTP source.
SwPodx(config)# clock timezone timezone offset-from-GMT SwPodx(config)# clock summer-time zone recurring SwPodx(config)# ntp server 10.x1.0.1
Step 1-7: Save the Configurations
Save the configurations into a text file for both the router and switch. They will be needed for future labs.