How to configure NTP On the Cisco Switches

edledge Cisco logo

Scenario:
Make
: Cisco
Model: Cisco 2960 Series
Mode: Command Line Interface [CLI]
Description: In this article, we will discuss a stepwise method of how to configure NTP or Network Time Protocol on the Cisco 2960 switch stack.

NTP

NTP stands for Network Time Protocol. NTP synchronizes timekeeping among a set of distributed time servers and clients. NTP uses the User Datagram Protocol (UDP) as its transport protocol. All NTP communication uses Coordinated Universal Time (UTC), which is the same as Greenwich Mean Time. NTP is used to allow network devices to synchronize their clocks with a central source clock. For network devices like routers, switches, or firewalls this is very important because we want to make sure that logging information and timestamps have the accurate time and date.

NTP Configuration

Follow the steps mentioned below to configure NTP on cisco switches

Step1: Login
SSH onto the switch and login into it using username and password.

SSH 10.1

Step2: Current NTP Status
Check the current NTP status on the switch. Follow the command shown below to confirm the current NTP configuration status on the Cisco stack. There are many options available to check NTP status as shown below.

edledge-switch#sh ntp
associations NTP associations
config NTP server/peer configs
information NTP Information
packets NTP Packet statistics
status NTP status

edledge-switch#sh ntp information
Ntp Software Name : Cisco-ntpv4
Ntp Software Version : Cisco-ntpv4-1.0
Ntp Software Vendor : CISCO
Ntp System Type : Cisco IOS / APM86XXX

edledge-switch#sh ntp status
Clock is synchronized, stratum 4, reference is 10.1.2.3
nominal freq is 286.1023 Hz, actual freq is 286.0861 Hz, precision is 2**21
ntp uptime is 1505375400 (1/100 of seconds), resolution is 3496
reference time is EXXXX647.1XXXXC44 (14:33:03.083 IST Sun Feb 18 2018)
clock offset is -5.3168 msec, root delay is 189.93 msec
root dispersion is 136.78 msec, peer dispersion is 0.10 msec
loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000056526 s/s
system poll interval is 1024, last update was 1176 sec ago.

edledge-switch#sh ntp config
ntp server edl-ntp-01.edledge.com
ntp server edl-ntp-02.edledge.com
ntp server edl-ntp-03.edledge.com

edledge-switch#sh ntp associations
address ref clock st when poll reach delay offset disp
*~10.1.2.3 10.1.2.4 3 160 1024 377 155.65 -5.316 0.109
~10.1.2.4 .STEP. 16 113d 1024 0 0.000 0.000 15937.
* sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
edledge-switch#

Step3: Configuration
Configure NTP executing the commands as shown below.

edledge-switch# conf t
edledge-switch(config)#
edledge-switch(config)#ntp server 10.1.2.3
edledge-switch(config)#exit
edledge-switch#



edledge-switch#conf t
edledge-switch(config)#clock timezone IST 5 30
edledge-switch(config)#exit
edledge-switch#

edledge-switch#sh clock
08:42:48.919 UTC Tue Apr 4 2023


edledge-switch#sh ntp associations
address ref clock st when poll reach delay offset disp
*~10.1.2.3 17.15.22.4 3 37 64 3 10.476 -6.931 78.431
* sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured

Step4: Check Clock
Check the current time by executing the command as shown below

edledge-switch#sh clock
15:28:06.426 IST Sun Feb 18 2024

The “show clock” command shows the software clock, while the “show calendar” command shows the hardware clock.

edledge-switch#sh calander
15:28:06 IST Sun Feb 18 2024

If The two clocks are not in sync, this can be fixed using the command as shown below:

edledge-switch#conf t
edledge-switch(config)#ntp update-calendar

The “ntp update-calander” command command will update the hardware clock with the time of the software clock.

Network Time Protocol [NTP] has been configured on the Cisco Switch stack.

Other topics on the Cisco Switch

SourceCisco, Knowledge Base, Internet

EA00153

Leave a Reply

Your email address will not be published. Required fields are marked *