Junos
Reply
Visitor
opalo
Posts: 2
Registered: ‎01-22-2009
0

Generate default route in ospf if bgp neighbor if up

Hello.

 

Its possible generate default route 0.0.0.0/0 in ospf only if bgp upstream provider are up?

I have to core Routers with BGP neighbor and need generate default route to PE routers only if ebgp are up. If BGP are down no have connection to Internet and no need propagate the default route to another routers because all routes are discard.

 

Thanks.

 

Super Contributor
masoodnt10
Posts: 80
Registered: ‎06-20-2008
0

Re: Generate default route in ospf if bgp neighbor if up

There are many soluitons and it depends on the way you are generating default route into OSPF. Here’s a quick little workaround that may work for you. You just have to generate a default route like:

generate {  
        route 0.0.0.0/0 policy upstream-routes-exist;
    }

policy-statement upstream-routes-exist {
        term only-certain-routes {
            from {
                route-filter 10.10.10/24 exact; "In your case whatever route you have"
            }
            then accept;
        }                                                               
        term reject {
            then reject;
        }
    }
Regards,
Masood
BLOG: http://weblogs.com.pk/jahil/
Visitor
opalo
Posts: 2
Registered: ‎01-22-2009
0

Re: Generate default route in ospf if bgp neighbor if up

Hello Masood.

 

But this policy-statement dont lookup up BGP session with provider are up, only if the route 10.10.10/24 are in the route table. Correct?

 

Thanks for your reply.

Super Contributor
davidjdv
Posts: 113
Registered: ‎02-26-2008
0

Re: Generate default route in ospf if bgp neighbor if up

Hello,

 

As Masood indicates, there are many ways to achieve this.

If you really want your policy to match on bgp routes learnt from your peer then use some thing like:

 

from {

   protocol bgp;

   neighbor <peer-ip-address>;

}

 

 

Don't forget to also advertise this generated route (technically an aggregate) into ospf:

 

from {

  protocol aggregate;

  route-filter 0.0.0.0/0 exact;

}

 

 

HTH,

/david 

Contributor
maclan13
Posts: 25
Registered: ‎01-19-2009
0

Re: Generate default route in ospf if bgp neighbor if up

Is there a way to advertise the default route in ospf to only one router in the area?  For ex.

 

MX-120 ====== MX-120

    \                        /

     \                      /

       Cisco Router

 

All the above devices are in the same OSPF area but I only want the default routes on the MX-120s to be advertised to the Cisco router and not easch other.

 

Can this be done or do I have to use another area?

Super Contributor
masoodnt10
Posts: 80
Registered: ‎06-20-2008

Re: Generate default route in ospf if bgp neighbor if up

Yea you can apply OSPF import policy which allows you to define policy to prevent adding OSPF routes to the routing table (External OSPF route only, I believe you are getting default route as an external route).

 

This filtering happens when OSPF installs the route in the routing table. You can filter the routes, but not LSA flooding. The import policy can filter on any attribute of the OSPF route.

Create a policy on the router whereever you want to reject ospf-default external route.

 

policy-statement ospf-import {
    term reject-default {
        from {
            route-filter 0.0.0.0/0 exact;
        }
        then reject;
    }
}


only way to kill it.. :smileyhappy:

 

ospf {
    import ospf-import;

Regards,
Masood
BLOG: http://weblogs.com.pk/jahil/
Contributor
maclan13
Posts: 25
Registered: ‎01-19-2009
0

Re: Generate default route in ospf if bgp neighbor if up

Thanks.
Copyright© 1999-2013 Juniper Networks, Inc. All rights reserved.