Routing

last person joined: 3 days ago 

Ask questions and share experiences about ACX Series, CTP Series, MX Series, PTX Series, SSR Series, JRR Series, and all things routing, including portfolios and protocols.
  • 1.  redistribute default route from bgp to ospf

    Posted 10-16-2012 05:45

    Hi ,

                                                                                                                                                     

    I have Two mx series router and connected to  two ISP link like this 

                               ospf /ibgp

    ISP1------MX1-------------------MX2---------ISP2

     

    Getting default route from EBGP on both router and redistributing this default route from ebgp to ospf on both router and in my rest of the LAN using IGP protocol OSPF . Now i want to set preference on OSPF  that default route from ISP1 should be prefer compare to ISP2 and If ISP1 default route  is not present that it should go through ISP1. I have tried definning External type1 to MX1 and E2 route on MX2 .but the result is not satisfactory. the route which is first redistributed will install in my OSPF database and its not changing till i stop the redistributing.

     

    Configuration :-

     

     

    For that what i did that i have made a import policy on MX1 :-

     

    show policy-options policy-statement bgp-to-ospf   
    term 1 {
        from {
            protocol bgp;
            neighbor 10.0.21.2;
            route-filter 0.0.0.0/0 exact;
        }
        then {
            external {
                type 1;
            }
            accept;
        }
    }

     

     

    show policy-options policy-statement ospf-import
    term 1 {
        from {
            protocol ospf;
            external;
            route-filter 0.0.0.0/0 exact;
        }
        then reject;
    }

     

    show protocols ospf  
    export bgp-to-ospf;
    import ospf-import;
    area 0.0.0.0 {
        interface ge-0/0/0.0;
        interface lo0.0 {
            passive;
        }
    }

    After applying this policy on MX1 ,now my route is getting prefernce from only MX1 router only .

     

    Is this policy is correct or wrong ?  please advice



  • 2.  RE: redistribute default route from bgp to ospf

    Posted 10-16-2012 09:22

    I'm not sure that I completely understand what you are doing, but if you want to have MX1 use ISP1 if it is up, and MX2 use ISP2 if it is up, but use the other ISP if the directly connected ISP is down, it might be easier to bring up an IBGP link between the two MX routers and exchange default routes, just de-preference them so they are only used as a backup.

     

    If you still also need to export a default route into OSPF for the internal network, you can setup an import filter on the MX routers so they don't learn the default via OSPF via the other MX (which would override the BGP default route).



  • 3.  RE: redistribute default route from bgp to ospf

    Posted 10-16-2012 10:27

    Thanks for your reply



    This is my requirement to redistribute default route from bgp to ospf because i have eight router in my internal network in ospf and default route should be reach to all router to reach internet.



    I have one more query that in cisco when redistribute default route from bgp to ospf than they configured "default-information originate". also in juniper i have read that we need to configured some policy for generate the default route that it will active if next-hop is reachable.exaple is below :-



    root@A#

    show policy-options policy-statement filter-contributors

    term 1 {

    from {

    neighbor 10.1.1.1;

    next-hop 10.1.1.1;

    }

    then accept;

    }

    term 2 {

    then reject;

    }



    root@A#

    show routing-options

    generate {

    route 0.0.0.0/0 {

    policy filter-contributors;

    discard;

    }

    }



    root@A#

    show policy-options policy-statement ospf-default

    from {

    route-filter 0.0.0.0/0 exact;

    }

    then accept;



    Now above policy will export in ospf .



    But what i did that  i don't configured the generate route for default route creation and i direclty redistributed the default route in ospf  which receiving from bgp and its working.



    show policy-options policy-statement bgp-to-ospf
    term 1 {
        from {
            protocol bgp;
            neighbor 10.0.21.2;
            route-filter 0.0.0.0/0 exact;
        }
        then {
            external {
                type 1;
            }
            accept;
        }
    }



    Now my query is that what is actual requirement of generate the default route to redistribut in ospf because i can directly redistribute in ospf which is receiving from bgp.



  • 4.  RE: redistribute default route from bgp to ospf
    Best Answer

    Posted 10-16-2012 15:06

    Hi,

     

    from your first post what I understand you have 2 ISPs and both of them advertise default route (pref 170) and you distribute this route through OSPF (pref 150) so each MX prefer the OSPF update.

     

    If so you can change the preference of OSPF external routes on both MX routers

     

    #set protocols ospf external-preference 175

     

    So it will change the preference of OSPF exxternal routes only to 175

     

    ----------------

     

    If your problem in the LAN 8 routers not prefering MX1 default route and prefer MX2 default route or which one come first you could change the metric in OSPF export policy on MX2 so it will solve your problem

     

    MX2# set policy-options policy-statement bgp-to-ospf term 1 then metric 40

     

    Mohamed Elhariry

     

    JNCIE-M/T # 1059, CCNP & CCIP

     

    ----------------------------------------------------------------------------------------------------------------------------------------

    If this post was helpful, please mark this post as an "Accepted Solution".Kudos are always appreciated!

     

     



  • 5.  RE: redistribute default route from bgp to ospf

    Posted 10-17-2012 07:53

    From your question:


    @Jagdish11 wrote:



    Now my query is that what is actual requirement of generate the default route to redistribut in ospf because i can directly redistribute in ospf which is receiving from bgp.


     

    My understanding is that to export a default route into OSPF, you need to have a valid default route in your routing table.  It doesn't matter where it comes from, static or a routing protocol, but you need to have a default route in order to send it to OSPF.



  • 6.  RE: redistribute default route from bgp to ospf

    Posted 10-17-2012 10:07

    Hi,

     

    Thanks for your reply..

     

    It means in my case ,i am getting  default route from bgp . So i didn't need to configured generate route for create the default route on my router...Is it correct ..

     

    Actually i am confused due to an attached document..i have tried this but the generate route work as a aggregate route with preference 130 for default and its blackhole the traffic.

     

     

     

     

     

    Attachment(s)



  • 7.  RE: redistribute default route from bgp to ospf

    Posted 10-17-2012 16:21

    Hi

     

    Yes that's exactly what I mean try to make the configuration simple as much as you can you already receive default route from your BGP peer and this route in your routing table as long as your BGP session is up so you can depend on that route and redistribute into your IGP 



  • 8.  RE: redistribute default route from bgp to ospf

    Posted 10-18-2012 10:22

    Thanks for your reply..

     

    Finally i am not configuring the generate route for default route creation and just redistributing the default route from bgp to ospf..