2960 - NTP Commands
You can manually set the time with:
show clock [detail]
clock set [hh:mm:ss] [month] [day] [year]
But, if you're going to use a Cisco 2960 as an local NTP server, its a good idea to have it reference something else!
Google has public NTP servers that SMEAR TIME: time.google.com
at 216.239.35.0
, time2.google.com
at 216.239.35.4
, etc.
1 Configure a default gateway (if required), and make sure we can ping the time server (eg, google: 216.239.35.0):
2960#en 2960#conf t Enter configuration commands, one per line. End with CNTL/Z. 2960(config)#ip default-gateway 10.10.10.254 2960(config)#do ping 216.239.35.0 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 216.239.35.0, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 122/322/1119 ms 2960(config)#
2 Set the NTP reference server:
2960(config)#ntp server 216.239.35.0 prefer 2960(config)#do sh ntp status Clock is synchronized, stratum 5, reference is 216.239.35.0 nominal freq is 286.1023 Hz, actual freq is 286.1023 Hz, precision is 2**21 ntp uptime is 1583123700 (1/100 of seconds), resolution is 3496 reference time is E9CA5041.C5FD3468 (11:42:25.773 UTC Wed Apr 17 2024) clock offset is -10816782.1259 msec, root delay is 125.89 msec root dispersion is 10817034.85 msec, peer dispersion is 187.55 msec loopfilter state is 'SPIK' (Spike), drift is 0.000000000 s/s system poll interval is 64, last update was 11 sec ago. 2960(config)#exit 2960#sh ntp associations address ref clock st when poll reach delay offset disp ~127.127.1.1 .LOCL. 7 5 16 3 0.000 0.000 3937.5 *~216.239.35.0 216.239.0.253 4 18 64 1 120.75 1.828 1937.5 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured
3 NTP time is always UTC, so if you're anywhere else in the world, you'll need to set your timezone and UTC offset.
2960(config)#do sh clock 12:54:55.087 UTC Wed Apr 17 2022 2960(config)#clock timezone UTC +2
To specify time zone and daylight settings two commands are used:
2960(config)#clock ? summer-time Configure summer (daylight savings) time timezone Configure time zone
Time zone configuration requires 2 parameters:
clock timezone zone hours-offset [minutes-offset]
Summer-time configuration can be either recurring or date-specific:
clock summer-time zone recurring [week day month hh:mm week day month hh:mm [offset]]
clock summer-time zone date date month year hh:mm date month year hh:mm [offset]
Eg:
2960(config)#clock timezone NYC -5 2960(config)#clock summer-time NYCDST recurring 2 Sun Mar 2:00 1 Sun Nov 2:00
Refer to the following for timezone info and zone abbreviations: