Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

track a route from specific next-hop

‎03-02-2017 05:49 AM

Hi All,

 

I have a requirement of unique scenerio

 

i have two Internet facing EX4200.

 

EX01---->Primary Internet

EX02---->Secondary Internet

EX02---->Tertiary Internet

 

EX01--->EX02 run iBGP between them

 

i have certain prefixes on which i need to advertise through Tertiary Internet only if Primary and Secondary Internet is down

we are just receiving default route.

 

Is there anyway i can check default route and its next-hop in the routing table and then decide to advertise my prefixes to Tertiary Internet?

 

Thanks in Advance.

3 REPLIES 3
Highlighted
Junos Automation (Scripting)

Re: track a route from specific next-hop

‎03-02-2017 06:11 AM

HI !

 

--You maybe need a sort of

 

policy-options {
    policy-statement conditional_route {
        term 1 {
            from {
                route-filter <advertising route> exact;
                condition check_route;
            }
            then reject;
        }
        term 2 {
            from {
                route-filter <advertising route> exact;
                
            }
            then accept;
        }

    }
}

policy-options {
    condition check_route {                    
        if-route-exists {
            192.168.1.0/24;  <----- a next-hop only reachable when connection is up
            table inet.0;
        }
    }
}

routing-options {
    static {
        route <advertising route> discard {
        preference 200;
        }
    }
}

 

and then use the policy as export for BGP

and thus the route will only be announced when the route in the condition has gone

 

reagrds

 

alexander

Highlighted
Junos Automation (Scripting)

Re: track a route from specific next-hop

‎03-02-2017 07:04 AM

 

in my requirement i am received a default route from all 3 ISPs

 

at one time only one is active.

 

so on EX02 i have to check if default router from tertiary ISP is active then advertise the Local Prefixes otherwise not.

 

i will have two conditions 

 

condition one matching the /30 route of secondary ISP

condition two matching the 0.0.0.0/0 route (learnt from Primary ISP on EX01 and sent to EX02 over iBGP) in inet.0 which i would receive from iBGP

 

i need an OR of above both conditions so i guess i can use OR let me try.

 

Highlighted
Junos Automation (Scripting)

Re: track a route from specific next-hop

‎03-02-2017 07:26 AM

i guess i am able to create a solution it is a bit tedious thanks for direction but i had to play with policies and conditions both.

 

i had to put the iBGP route in a separate routing-table because at one time 3 default routes are accepted in inet.0 and one is from the Tertiary BGP Neighbor.

 

so 2nd condition of default route i match in separate routing table just to check if it is receiving it would put it in that routing-table.

 

then i defined two separate policies using those two conditions 

 

then i used those two policies as from policy  (! (POL1 || POL2)) 

 

thats what did it so at one time any one of condition is true it would not advertise.

 

Thanks.

Feedback