Objective

Setting up a time range is useful if you want other features of the switch to be triggered or activated at a certain time. In addition, you can also specify how long a range can last for features that you want to disable after a period of time. Recurring time ranges can also be set if you want to continuously enable and disable a feature. Several of these features rely on time ranges to implement security or access control.

Time ranges can be defined and associated with the following types of commands:

- Access Control Lists (ACLs) — Time ranges are used to limit the amount of time the ACL and Access Control Entry (ACE) are in effect. This can be useful to limit network traffic filters at certain times. For example, you could allow users to access specific resources to only business hours.

- 802.1x Port Authentication — Time ranges are used to define a time period at which 802.1x is active on 802.1x-enabled ports. This can be useful to limit access to a network at certain times. For example, you could limit office network access to only business hours.

- Port Settings — You can configure the Up or Down state of the port for a specific period. When the time range is not active, the port is in shutdown. If a time range is configured, it is effective only when the port is administratively Up.

- Time-Based Power over Ethernet (PoE) — PoE can be configured on the device for a specific period. This feature enables you to define, per port, the days in the week and the hours that PoE is enabled. When the time range is not active, PoE is disabled.

There are two types of time ranges:

- Absolute — This type of time range begins on a specific date or immediately and ends on a specific date or extends infinitely. A recurring element can be added to it.

- Recurring — This type of time range contains a time range element that is added to an absolute range, and begins and ends on a recurring basis.

If a time range includes both absolute and recurring ranges, the operations of the associated commands are active only if both absolute start time and the recurring time range have been reached. Operations of the associated commands are inactive when either of the time ranges is reached.

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

Note: To configure the time range settings of your switch using the web-based utility, click here.

Applicable Devices

- Sx300 Series

- Sx350 Series

- SG350X Series

- Sx500 Series

- Sx550X Series

Software Version

- 1.4.7.06 — Sx300, Sx500

- 2.2.8.04 — Sx350, SG350X, Sx550X

Configure Time Range Settings on a Switch through the CLI

Configure Absolute Time Range Settings

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. From the Privileged EXEC mode of the switch, enter the Global Configuration mode by entering the following:

Step 3. Enter the time-range command to define time ranges for different functions by entering the following:

- time-range-name — Specifies the name for the time range. The range is from one to 32 characters.

Note: In this example, the time range name is Dayshift.

Step 4. (Optional) To remove the time range from the switch, enter the following:

Step 5. To determine the starting point of the absolute time range, enter the following:

Important: The permit or deny statement of the associated function is going to take effect at the defined absolute start time and date. If no start time and date are specified, the function is in effect immediately.

The options are:

- hh:mm — The time in hours (military format) and minutes. The range is from 0 to 23 hours, and 00 to 59 in minutes.

- day — The day (by date) in the month. You can enter values from 1 to 31.

- month — The first three letters of the month name. The range is from Jan to Dec.

- year — The start year with no abbreviation. You can enter year 2000 up to year 2097.

Note: In this example, the absolute time range starts on January 1, 2017 at 8:00 in the morning.

Step 6. (Optional) To remove the start date and time, enter the following:

Step 7. To determine the end point of the absolute time range, enter the following:

Important: The permit or deny statement of the associated function will no longer take effect at the defined absolute end time and date. If no end time and date are specified, the effect of the function will never end.

The options are:

- hh:mm — The time in hours (military format) and minutes. The range is 0 to 23 hours, and 00 to 59 in minutes.

- day — The day (by date) in the month. You can enter values from 1 to 31.

- month — The first three letters of the month name. The range is from Jan to Dec.

- year — The start year with no abbreviation. You can enter year 2000 up to year 2097.

Note: In this example, the absolute time range ends on December 31, 2017 at 17:00 in the afternoon.

Step 8. (Optional) To remove the end date and time, enter the following:

Step 9. To go back to the Privileged EXEC mode, enter the following:

Step 10. To show the configured recurring or periodic time range settings on your switch, enter the following:

Note: In this example, the absolute time range settings for the time range Dayshift is displayed.

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 configured the absolute time range settings on your switch through the CLI.

Configure Recurring or Periodic Time Range Settings

A recurring or periodic time element can be added to an absolute time range. This limits the operation to certain time periods within the absolute range.

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

Step 2. Enter the time-range command to define time ranges for different functions by entering the following:

- time-range-name — Specifies the name for the time range. The range is from one to 32 characters.

Note: In this example, the time range name is Dayshift.

Step 3. To specify a day of the week and a time (in 24-hour format) that the time range begins on a recurring basis, enter any of the following:

The options are:

- day-of-the-week — The starting day that the associated time range is in effect. The second occurrence is the ending day the associated statement is in effect. The second occurrence can be the following week. Possible values are: mon, tue, wed, thu, fri, sat, and sun.

- hh:mm — The first occurrence of this argument is the starting hours and minutes (military format) that the associated time range is in effect. The second occurrence is the ending hours and minutes (military format) the associated statement is in effect. The second occurrence can be at the following day. The range is from 0 to 23 hours, and 00 to 59 in minutes.

- list day-of-the-week1 — Specifies a list of days that the time range is in effect.

- all — Specifies all days of the week.

Note: The second occurrence of the day can be at the following week. For example, Thursday to Monday means that the time range is effective on Thursday, Friday, Saturday, Sunday, and Monday. While the second occurrence of the time can be on the following day, such as 22:00 to 2:00 of the next day.

Note: In this example, the recurring time range starts every Monday at 8:00 in the morning and ends every Friday at 17:00 in the afternoon.

Step 4. (Optional) To remove the periodic date and time limitation, enter the no command to the configured time range in Step 3 by entering either of the following:

Step 5. To go back to the Privileged EXEC mode, enter the following:

Step 6. To show the configured recurring or periodic time range settings on your switch, enter the following:

Note: In this example, the absolute and periodic time range settings for the time range Dayshift is displayed.

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

Step 8. (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 configured the recurring time range settings on your switch through the CLI.