NTP Version 3 (RFC 1305) allows IP hosts to synchronize their time-of-day clocks with a common source clock. For instance, routers and switches can synchronize their clocks to make event correlation from an SNMP management station more meaningful, by ensuring that any events and traps have accurate time stamps.
By design, most routers and switches use NTP client mode, adjusting their clocks based on the time as known by an NTP server. NTP defines the messages that flow between client and server, and the algorithms a client uses to adjust its clock. Routers and switches can also be configured as NTP servers, as well as using NTP symmetric active mode—a mode in which the router or switch mutually synchronizes with another NTP host. NTP servers may reference other NTP servers to obtain a more accurate clock source as defined by the stratum level of the ultimate source clock.
33.1 CLOCK SET
Use the clock set command to set static time. The static time won’t save to configuration file. You can verify your setting by entering the show clock Privileged EXEC command.
Switch# clock set HH:MM:SS (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov |dec) <1-31> <2000-2035>
Syntax |
clock set HH:MM:SS (jan|feb|mar|apr|may|jun|jul|aug| sep|oct|nov|dec)<1-31><2000-2035> |
Parameter |
HH:MM:SS <1-31> (jan|feb|mar|apr|may|jun|jul|aug| sep|oct|nov|dec) <2000-2035> Specify static time of year, month, day, hour, minute, second |
Default |
No default is defined. The clock set to 2000/01/01 08:00:00 by default at startup. |
Mode |
Privileged EXEC |
Example |
The example shows how to set static time of switch. Switch# clock set 10:57:00 feb 1 2020 Switch# show clock |
33.22 Clock timezone
CLOCK TIMEZONE
Use the clock timezone command to set timezone setting. Use the “no” form of this command to restore to default setting. You can verify your setting by entering the show clock detail Privileged EXEC command.
Switch#configure terminal
Switch(config)# clock timezone ACRONYM HOUR-OFFSET [minutes <0-59>]
Switch# no clock timezone
Syntax |
clock timezone (ACRONYM HOUR-OFFSET) [minutes <0-59>] no clock timezone |
Parameter |
ACRONYM Specify acronym name of time zone HOUR-OFFSET Specify hour offset of time zone Minutes <1-59>Specify minute offset of time zone |
Default |
Default time zone is UTC+8. |
Mode |
Global Configuration |
Example |
The example shows how to set time zone of switch and then restore to default time zone. Switch#configure terminal Switch(config)# clock timezone test +5 Switch# show clock detail Switch(config)# no clock timezone Switch# show clock detail |
33.3 CLOCK SOURCE
Use the clock source command to set the source of time. Use the “no” form of this command to restore to default setting. You can verify your setting by entering the show clock detail Privileged EXEC command.
Switch#configure terminal
Switch(config)# clock source (local|sntp)
Syntax |
clock source (local|sntp) |
Parameter |
local Specify to use static time sntp Specify to use sntp time |
Default |
Default is using local time |
Mode |
Global Configuration |
Example |
The example shows how to set clock source of switch. Switch#configure terminal Switch(config)# clock source sntp Switch(config)# show clock detail |
33.4 CLOCK SUMMER-TIME
Use the clock summer-time command to set daylight saving time for system time. The “usa” or “eu” means that use the global daylight saving policy which defined by international organization. In both the “date”and “recurring”, the first part of the command specifies when summer time begins, and the second part specifies when it ends. All times are relative to the local time zone. The “recurring” means that adjust time every year within the month.Use the no form of this command to default setting.You can verify your setting by entering the show clock detail Privileged EXEC command.
Switch#configure terminal
Switch(config)# clock summer-time ACRONYM date (jan|feb|mar|apr |may|jun|jul|aug|sep|oct|nov|dec) <1-31><2000-2037>
HH:MM (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) <1-31><2000-2037> HH:MM [<1-1440>]
Switch(config)# clock summer-time ACRONYM recurring (usa|eu) [<1-1440>] clock summer-time ACRONYM recurring (<1-5>|first|last)
(sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) HH:MM (<1-5>|first|last) (sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) HH:MM [<1-1440>]
Switch(config)# no clock summer-time
Syntax |
clock summer-time ACRONYM date (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) <1-31><2000-2037> HH:MM (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) <1-31><2000-2037> HH:MM [<1-1440>] clock summer-time ACRONYM recurring (usa|eu) [<1-1440>] clock summer-time ACRONYM recurring (<1-5>|first|last) (sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) HH:MM (<1-5>|first|last) (sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec) HH:MM [<1-1440>] no clock summer-time |
Parameter |
ACRONYM<1-31> Specify acronym name of time zone (jan|feb|mar|apr| may|jun|jul|aug|sep| oct|nov|dec) <2000-2037>HH:MM Specify non-recurring daylight saving time duration. <1-1440>Specify adjust offset of daylight saving time usa Using daylight saving time in the United States that starts on the second Sunday of March and ends on the first Sunday of November eu Using daylight saving time in the Europe that starts on the last Sunday in March and ending on the last Sunday in October (<1-5>|first|last) (sun|mon| tue|wed|thu|fri|sat) (jan|feb|mar|apr|may|jun| jul|aug|sep|oct|nov|dec) HH:MM (<1-5>|first|last) (sun|mon|tue|wed|thu|fri|sat) (jan|feb|mar|apr|may| jun|jul|aug|sep|oct|nov|dec) HH:MM Specify ecurring daylight saving time duration. |
Mode |
Global Configuration |
Example |
The example shows how to set clock summer time of switch. You can verify settings by the following show show clock command. Switch#configure terminal Switch(config)# clock summer-time test recurring usa Switch# show clock detail |
33.5 SHOW CLOCK
Use the show clock command to show clock of switch. The “detail” means that show more information of clock such as time zone and daylight saving time.
Switch# show clock [detail]
Syntax |
show clock [detail] |
Parameter |
detail Show more detail information of clock |
Mode |
Privileged EXEC |
Example |
The example shows how to show clock of switch and detail information. Switch#configure terminal Switch(config)# clock source sntp Switch(config)# clock summer-time DLS recurring usa Switch(config)# sntp host 192.168.1.100 Switch# show clock Switch# show clock detail |
33.6 SNTP
Use the sntp command to set remote SNTP server. Use the no form of this command to default setting.You can verify your setting by entering the show sntp Privileged EXEC command.
Switch#configure terminal
Switch(config)# sntp host HOSTNAME [port <1-65535>]
Switch(config)# no sntp
Syntax |
sntp host HOSTNAME [port <1-65535>] no sntp |
Parameter |
HOSTNAME Specify ip address or hostname of sntp server sntp Specify server port of sntp server |
Default |
No default SNTP server defined. Default server port is 123 when server created. |
Mode |
Global Configuration |
Example |
The example shows how to set remote SNTP server of switch. Switch#configure terminal Switch(config)# clock source sntp Switch(config)# sntp host 192.168.1.100 Switch(config)# show sntp |
33.7 SHOW SNTP
Use the show sntp command to remote SNTP server information.
Switch# show sntp
Syntax |
show sntp |
Mode |
Privileged EXEC |
Example |
The example shows how to show remote SNTP server. Switch# show sntp |