Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 

Configure System Time Settings on a Switch through the Command Line Interface (CLI)

Objective

System time configuration is of great importance in a network. Synchronized system clocks provide a frame of reference between all devices on the network. Network time synchronization is critical because every aspect of managing, securing, planning, and debugging a network involves determining when events occur. Without synchronized clocks, accurately correlating log files between devices when tracking security breaches or network usage is impossible.

Synchronized time also reduces confusion in shared file systems, as it is important for the modification times to be consistent, regardless of the machine on which the file systems reside. The Cisco Small Business Switches support Simple Network Time Protocol (SNTP), and when enabled, the switch dynamically synchronizes the device time with time from an SNTP server.

You can manage the system time and date settings on your switch using automatic configuration, such as the SNTP, or manual configuration methods. The switch operates only as an SNTP client, and cannot provide time services to other devices.

This article provides instructions on how to configure the system time settings on your switch through the Command Line Interface (CLI).

Note: To configure the system time settings on your switch through the web-based utility, click here.

Applicable Devices

  • Sx300 Series
  • Sx350 Series
  • SG350X Series
  • Sx300 Series
  • Sx550X Series

Software Version

  • 1.4.7.05 — Sx300, Sx500
  • 2.2.8.04 — Sx350, SG350X, Sx550X

Configure System Time Settings on your Switch through the CLI

By default, there is no configured network policy on the switch. The default LLDP-MED global and interface settings are the following:

Feature

Default Setting

Clock Source

SNTP

Time from Browser

Disabled

Time Zone (Static)

Offset is UTC+0  

DHCP Time zone

Disabled

Summer Time (DST)   

Disabled

View System Time Settings on the Switch

Step 1. Log in to the switch console. The default username and password is cisco/cisco. If you have configured a new username or password, enter the credentials instead.

Note: The commands may vary depending on the exact model of your switch. In this example, the SG350X switch is accessed through Telnet.

Step 2. To display the current configuration settings of the port or ports that you want to configure, enter the following:

  • detail — (Optional) Displays the time zone and summer time configuration.

The following information are displayed:

  • Actual Time — System time on the device. This shows the Dynamic Host Configuration Protocol (DHCP) time zone and the acronym of the time zone.
  • Time source — The external time source for the system clock.
  • Time from Browser — Specifies if the date and time of the switch is set from the configuring computer using a web browser.
  • Time zone (Static) — The time zone for display purposes.
  • DHCP timezone — Specifies that the time zone and the Summer Time or Daylight Saving Time (DST) settings of the system can be taken from the DHCP Timezone option.

Step 3. Choose your preferred system time configuration:

  • Automatic Settings — If this is enabled, the system time is obtained from an SNTP server.
  • Manual Settings — Set the date and time manually. The local time is used when there is no alternate source of time, such as an SNTP server.

Configure Automatic Time Settings

Step 1. In the Privileged EXEC mode of the switch, enter the Global Configuration context by entering the following:

Step 2. To configure an external time source, enter the following:

The options are:

  • sntp — (Optional) Specifies that an SNTP server is the external clock source.
  • browser — (Optional) Specifies that if the system clock is not already set (either manually or by SNTP), the system clock will be set according to the time information of the web browser once a user logs in to the switch, either via Hypertext Transfer Protocol (HTTP) or HTTP Secure (HTTPS).

Note: In this example, sntp is configured as the main clock source and the browser as the alternate clock source.

Step 3. (Optional) To display the configured system time settings, enter the following:

Step 4. (Optional) In the Privileged EXEC mode of the switch, save the configured settings to the startup configuration file, by entering the following:

Step 5. (Optional) Press Y for Yes or N for No on your keyboard once the Overwrite file [startup-config]… prompt appears.

You should now have automatically configured the system time settings on your switch through the CLI.

Configure Manual Time Settings

If no other source of time is available, you can manually configure the time and date after the system is restarted. The time remains accurate until the next system restart. It is recommended that you use manual configuration only as a last resort. If you have an outside source to which the switch can synchronize, you do not need to manually set the system clock.

Important: If you have an outside source on the network that provides time services such as an SNTP server, you do not need to manually set the system clock.

To manually configure the system time settings on your switch, follow these steps:

Step 1. In the Privileged EXEC mode of the switch, enter the following:

The options are:

  • hh:mm:ss — Specifies the current time in hours (military format), minutes, and seconds. The range are the following:

- hh — 0 to 23

- mm — 0 to 59

- ss — 0 to 59

  • day — Specifies the current day of the month. The range is from 1 to 31.
  • month — Specifies the current month using the first three letters of the month name. The range is from Jan (January) to Dec (December).
  • year — Specifies the current year. The range is from year 2000 up to 2037.

Note: After reboot, the system clock is set to the time of the image creation. In this example, the clock time is set to 12:15:30 with the clock date of May 12, 2017.

Step 2. In the Privileged EXEC mode of the switch, enter the Global Configuration context by entering the following:

Step 3. To disable the SNTP as the time source for the system clock, enter the following:

Step 4. (Optional) To set the time zone for display purposes, enter the following:

The options are:

  • zone — The acronym of the time zone. The range is up to four characters.
  • hours-offset — The hours difference from UTC. The range is from -12 to +13.
  • minutes-offset — (Optional) The minutes difference from UTC. The range is from 0 to 59.

Note: The system internally keeps time in UTC, so this command is used only for display purposes and when the time is manually set.

Step 5. (Optional) To restore the default time zone configuration settings, enter the following:

Step 6. (Optional) To specify that the time zone and the Summer Time (DST) of the system can be taken from the DHCP time zone option, enter the following:

Upon configuring the DHCP time zone, check the following guidelines:

  • The time zone taken from the DHCP server has precedence over the static time zone.
  • The Summer Time taken from the DHCP server has precedence over static Summer Time.
  • The time zone and Summer Time remain effective after the IP address lease time has expired.
  • The time zone and Summer Time that are taken from the DHCP server are cleared after reboot.
  • In case of multiple DHCP-enabled interfaces, the following precedence is applied:

- The information received from DHCPv6 precedes information received from DHCPv4

- The information received from DHCP client running on lower interface precedes information received from DHCP client running on higher interface

  • Disabling the DHCP client from where the DHCP-timezone option was taken clears the dynamic time zone and Summer Time configuration.

Step 7. (Optional) To restore the default DHCP time zone configuration, enter the following:

Step 8. (Optional) To configure the system to automatically switch to Summer Time (DST), enter one of following:

The options are:

  • zone — The acronym of the time zone to be displayed when summer time is in effect. The range is up to four characters.
  • recurring — Indicates that summer time starts and ends on the corresponding specified days every year.
  • date — Indicates that summer time starts on the first date listed in the command and ends on the second date in the command.
  • usa — The summer time rules are the United States rules. The rules are:

- Start — Second Sunday in March

- End — First Sunday in November

- Time 2 a.m. local time

  • eu — The summer time rules are the European Union rules. The rules are:

- Start — Last Sunday in March

- End — Last Sunday in October

- Time 1 a.m. local time

  • week — Week of the month. The week can be 1 to 5, first to last. Week within the month when DST begins or ends every year.
  • day — Day of the week (first three characters by name, such as Sun). Day of the week when DST begins or ends every year.
  • date — Date of the month. The range is from 1 to 31.
  • month — Month (first three characters by name, such as Feb). Month of the year when DST begins or ends every year.
  • year — year (no abbreviation). The range is from year 2000 up to 2097.
  • hh:mm — Time in military format, in hours and minutes. Time when DST begins or ends every year. The range are the following:

- hh — 0 to 23

- mm — 0 to 59

- ss — 0 to 59

  • offset — (Optional) Number of minutes to add during summer time. The range is from 0 to 1440 minutes and the default is 60.

Note: In this example, a recurring DST is configured with PST time zone. It starts every 00:00 on the first Sunday of March, and ends every second Sunday of November. The offset time is 60 minutes.

Step 9. Enter the exit command to go back to the Privileged EXEC mode:

Step 10. (Optional) To display the configured system time settings, enter the following:

Step 11. (Optional) In the Privileged EXEC mode of the switch, save the configured settings to the startup configuration file, by entering the following:

Step 12. (Optional) Press Y for Yes or N for No on your keyboard once the Overwrite file [startup-config]… prompt appears.

You should now have successfully manually configured the system time settings on your switch through the CLI.

Version history
Revision #:
1 of 1
Last update:
‎05-29-2017 08:47 PM