Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Example: Configuring Schedulers

    This example shows how to configure schedulers.

    Requirements

    Before you begin:

    • Understand security policies schedulers. See Security Policies Overview.
    • Configure security zones before applying this configuration.

    Overview

    Schedulers are powerful features that allow a policy to be activated for a specified duration. You can define schedulers for a single (nonrecurrent) or recurrent time slot within which a policy is active. If you want a policy to be active within a scheduled time, then you must first create a scheduler.

    To configure a scheduler, you enter a meaningful name and a start and stop time for the scheduler. You can also attach comments.

    In this example, you:

    • Specify the scheduler, sch1, that allows a policy, which refers to it, to be used for packet match checks from 8 AM to 9 PM all days of the week from October 1, 2009 to June, 2010 except Sundays.
    • Configure another scheduler, SunHrs, to check for packet matches from noon to 6 PM on Sundays.
    • Create a policy, abc, and specify the match conditions and action to be taken on traffic that matches the specified conditions. and bind the schedulers to the policy to allow access during the specified weekend hours.

    Configuration

    CLI Quick Configuration

    To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

    set schedulers scheduler sch1 start-date 2009-10-01.08:00 stop-date 2010-06-01.21:00set schedulers scheduler sch1 sunday exclude set schedulers scheduler SunHrs sunday start-time 12:00 stop-time 18:00 set security policies from-zone green to-zone red policy abc match source-address anyset security policies from-zone green to-zone red policy abc match destination-address anyset security policies from-zone green to-zone red policy abc match application anyset security policies from-zone green to-zone red policy abc then permitset security policies from-zone green to-zone red policy abc scheduler-name sch1set security policies default-policy permit-all

    Step-by-Step Procedure

    The following example requires you to navigate various levels in the configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration Mode in the Junos OS CLI User Guide PDF Document.

    To configure a scheduler:

    1. Set a scheduler.
      [edit schedulers ]user@host# set scheduler sch1 start-date 2009-10-01.08:00 stop-date 2010-06-01.21:00user@host# set scheduler sch1 sunday exclude
    2. Set another scheduler.
      [edit schedulers]user@host# set scheduler SunHrs sunday start-time 12:00 stop-time 18:00
    3. Specify the match conditions for the policy.
      [edit security policies from-zone green to-zone red policy abc]user@host# set match source-address any destination-address any application any
    4. Specify the action.
      [edit security policies from-zone green to-zone red policy abc]user@host# set then permit
    5. Associate the scheduler to the policy.
      [edit security policies from-zone green to-zone red policy abc ]user@host# set scheduler-name sch1

    Results

    From configuration mode, confirm your configuration by entering the show schedulers command. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.

    [edit][user@host]show schedulersscheduler sch1 {start-date 2009-10-01.08:00 stop-date 2010-06-01.21:00;sunday exclude;}scheduler SunHrs {sunday {start-time 12:00 stop-time 18:00;}}[edit][user@host]show security policiesfrom-zone green to-zone red {policy abc {match {source-address any;destination-address any;application any;}then {permit;}scheduler-name sch1;}}default-policy {permit-all;}

    If you are done configuring the device, enter commit from configuration mode.

    Verification

    To confirm that the configuration is working properly, perform these tasks:

    Verifying Schedulers are Active

    Purpose

    Verify if schedulers are enabled or not.

    Action

    From operational mode, enter the show schedulers command.

    Verifying Policies

    Purpose

    Verify if the policies are working.

    Action

    From operational mode, enter the show security policies command.

    Published: 2012-06-29