How to Configure System Clock

It is very important to configure the correct clock for network devices such as routers and switches. If the clock is not configured correctly, it will be difficult to analyze the logs generated by the network devices. It can also cause problems such as not being able to properly determine the expiration date of certificates.

There are two ways to configure the clock for Cisco devices.

  • Manual Configuration
  • NTP(Network Time Protocol)

Configure Time Zone

When configuring the clock, you will also need to configure the appropriate time zone. The default is UTC. Specify the appropriate time zone according to the region where the device will be used. In global configuration mode, enter the following command

Configure Time Zone

(config)#clock timezone <name-of-timezone> <hours-offset> [<minutes-offset>]

<name-of-timezone> : Timezone name
<hours-offset> : time difference(hours)
<minutes-offset> : time difference(minitues)

is a string used to identify the time zone. You don’t have to use a specific string, but in Japan, it is usually “JST”. After that, specify as the time difference in hours, plus if it is ahead of UTC, minus if it is behind. If necessary, you can also specify the time difference in minutes using . In Japan time, the time difference is 9 hours ahead of UTC. Therefore, the time zone configuration for Japan time is usually as follows.

clock timezone JST 9

Manual Configuration

You can manually configure the clock on Cisco devices. To configure the clock, use the following command in privileged EXEC mode.

Manual configuration

#clock set <hh:mm:ss> <day> <month> <year>

<hh:mm:ss> : time:minite:second
<day> : day
<month> : month
<year> : year

Note that the clock configured manually by the clock set command will be lost when the device is rebooted.

NTP

Manually configuring the clock with the clock set command every time the device is rebooted is tedious. Even if you keep running the system without rebooting, the clock will gradually become out of sync. With NTP, you don’t need to reconfigure the clock every time you reboot. And NTP can also compensate for clock deviations.

To configure as an NTP client to synchronize the clock with an NTP server, enter the following command in global configuration mode.

Specify the NTP server you want to synchronize the time with.

(config)#ntp server <ip-address>

<ip-address> : IP address of NTP server

Verify the clock.

To verify the clock, run the show clock command.

R1#show clock
15:12:02.291 JST Wed Feb 17 2021

To verify that the clock is synchronized properly with the NTP server, execute the show ntp association command.

R1#show ntp associations

      address         ref clock     st  when  poll reach  delay  offset    disp
*~192.168.0.1      127.127.7.1       5     8    64  377    36.2  -18.15     5.2
 * master (synced), # master (unsynced), + selected, - candidate, ~ configured

If there is a “*”, the clock has been successfully synchronized with the NTP server.

Cisco Basic