Conditional configuration groups

There is the possibility in JunOS to define conditions under which a group can be applied.

A group can be applied based on the type of chassis, model, routing-engine, virtual-chassis member, cluster node and start and end time of  day or date.

By applying a group based on the time, you can have configure for instance the Cisco’s time based ACLs.

Let’s assume that we have this topology:

R1(ge-0/0/0-1.1.1.1/24) ———- (ge-0/0/0-1.1.1.2/24)R2(lo0-10.255.26.130/32)

And you are requested to have a static route on R1 only in the interval 09:00 and 18:00.

By configuring this group, the router will enable the static route as long the time configured on the router is between 09:00 and 18:00 of each day:

 

[edit]
root@R1# show groups STATIC-ROUTE                                                           
when {
    time 09:00 to 17:00;
}
routing-options {
    static {
        route 10.255.26.130/32 next-hop 1.1.1.2;
    }
}

[edit]
root@R1# 

[edit]
root@R1# show | display set | match STATIC-ROUTE | match apply 
set apply-groups STATIC-ROUTE

[edit]
root@R1#

We have the possibility to test the configuration without waiting the time on the router to fall within the interval:

 

[edit]
root@R1#show routing-options static route 10.255.26.130/32 | display inheritance when time 12 
##
## '1.1.1.2' was inherited from group 'STATIC-ROUTE'
##
next-hop 1.1.1.2;

[edit]
root@R1#

And if we are out of the time interval:

 

[edit]
root@R1# show routing-options static route 10.255.26.130/32 | display inheritance when time 19    

[edit]
root@R1#

Let’s check the time on the router and see if the static route is present in the routing table:

[edit]
root@R1# run show system uptime 
Current time: 2013-07-23 13:21:48 PDT
System booted: 2013-07-23 07:31:44 PDT (05:50:04 ago)
Protocols started: 2013-07-23 07:32:36 PDT (05:49:12 ago)
Last configured: 2013-07-23 13:14:25 PDT (00:07:23 ago) by root
 1:21PM  up 5:50, 3 users, load averages: 0.00, 0.00, 0.00

[edit]
root@R1# run show route 10.255.26.130                                                             

inet.0: 25 destinations, 25 routes (25 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.255.26.130/32   *[Static/5] 00:10:05
                    > to 1.1.1.2 via ge-0/0/0.0

[edit]
root@R1#

Let’s modify the time on router so we would be outside of the interval 09:00 – 17:00:

 

[edit]
root@R1# run show system uptime           
Current time: 2013-07-24 00:12:23 PDT
System booted: 2013-07-23 07:31:43 PDT (1d 16:40 ago)
Protocols started: 2013-07-23 07:32:37 PDT (1d 16:39 ago)
Last configured: 2013-07-25 00:11:52 PDT (00:00:31 ago) by root
12:12AM  up 1 day, 16:41, 2 users, load averages: 0.00, 0.00, 0.00

[edit]
root@R1# run show route 10.255.26.130 

[edit]
root@R1#
The following two tabs change content below.

Paris ARAU

Paris ARAU is a networking professional with strong background on routing and switching technologies. He is a holder of CCIE R&S and dual JNCIE(SP and ENT). The day to day work allows him to dive deeply in networking technologies. Part of the continuously training, he is focusing on Software Defined Network and cloud computing.

Comments

So empty here ... leave a comment!

Leave a Reply

Your email address will not be published. Required fields are marked *

Sidebar



%d bloggers like this: