Routing

Expand all | Collapse all

Advertising route from ospf to ibgp

Jump to Best Answer
  • 1.  Advertising route from ospf to ibgp

    Posted 03-13-2019 08:31

    Hello Folks,

     

    i need to advertise specific routes learned from a customer who uses ospf, to my ibgp table. 

    Whats the right way to do it ?

    I already established the ospf neighborship and can see the route in inet.0.

    But i need the routes learned at ospf to be in my L3.inet.0



  • 2.  RE: Advertising route from ospf to ibgp

     
    Posted 03-13-2019 08:50

    Hi,

     

    You can use simple policy to redistribute the route.

     

    set policy-options policy-statement OSPF-BGP term 1 from protocol ospf route-filter 1.1.1.1/32 exact

    set policy-options policy-statement OSPF-BGP term 1 then accept

    set protocols bgp export OSPF-BGP

     

    L3 is VRF or Virtual-router?



  • 3.  RE: Advertising route from ospf to ibgp

    Posted 03-14-2019 03:17

    Thanks. L3 is a vrf



  • 4.  RE: Advertising route from ospf to ibgp

     
    Posted 03-14-2019 03:24

    You can try below to leak the router from inet.0 to L3.inet.0

     

    set routing-options rib-groups LEAK import-rib inet.0
    set routing-options rib-groups LEAK import-rib L3.inet.0
    set routing-options interface-routes rib-group LEAK
    set protocols ospf rib-group LEAK



  • 5.  RE: Advertising route from ospf to ibgp

     
    Posted 03-14-2019 06:11

    You might want to add a policy to Mayar's solution, which I agree is the way to solve this, so that you don't leak ALL interfaces into your vrf.  

     

    set routing-options rib-groups LEAK import-rib inet.0 
    set routing-options rib-groups LEAK import-rib L3.inet.0 

    set routing-options rib-groups LEAK import-policy some-interfaces  ### I would add this
    set routing-options interface-routes rib-group LEAK
    set protocols ospf rib-group LEAK

     

    set policy-options policy-statement some-interfaces term customer-interface from interface <your-customer-interface>

    set policy-options policy-statement some-interfaces term customer-interface to rib L3.inet.0

    set policy-options policy-statement some-interfaces term customer-interface then accept

    set policy-options policy-statement some-interfaces term other-interfaces to rib L3.inet.0

    set policy-options policy-statement some-interfaces term other-interfaces then reject

    set policy-options policy-statement some-interfaces term to-inet0 to rib inet.0

    set policy-options policy-statement some-interfaces term to-inet0 then accept

       

     



  • 6.  RE: Advertising route from ospf to ibgp

    Posted 03-28-2019 04:48

    Thanks! Now i can see the routes learned from ospf at inet.0, at my L3.inet.0 table.

     

    But, I also need to export the routes from my L3.inet.0 to my ospf neighbour. How do i export bgp routes from vrf.inet.0 to ospf ?



  • 7.  RE: Advertising route from ospf to ibgp
    Best Answer

     
    Posted 03-28-2019 08:37

    You cannot because those BGP routes were learned as l3-vpn unicast routes and inet.0 accepts BGP famiy inet routes.  

     

    What you can do is configure a static route in inet.0 for the BGP prefixes in the L3.inet.0, with next-table L3.inet.0 instead of a next-hop. 

     

    For example, if you are receiving prefixes from the remote PE for the L3 VPN, for subnets of 172.16/16, you can create a static route that summarizes those routes, and points to table L3.inet.0, and then redistribute it into OSPF as shown:

     

    set routing-options static route 172.16/16 next-table L3.inet.0

     

    set policy-options policy-statement static2ospf term 1 from protocol static

    set policy-options policy-statement static2ospf term 1 from route-filter 172.16.0.0/16 exact

    set policy-options policy-statement static2ospf term 1 from condition remote-prefixes   ### so route is only advertised

    set policy-options policy-statement static2ospf term 1 then accept                                     ### if the present in L3.inet.0

     

    set policy-options condition remote-prefixes if-route-exists 172.16.2.1/32   

    set policy-options condition remote-prefixes if-route-exists table L3.inet.0

     

    set protocols ospf export static2ospf

     

    BGP-OSPF-L3VPN.png

     



  • 8.  RE: Advertising route from ospf to ibgp

    Posted 03-13-2019 16:24

    to send the routes from inet.0 to L3.inet.0 you will most likely need to use a rib group. 

    check this document it may help:

     

    https://www.juniper.net/documentation/en_US/junos/topics/example/policy-duplicating-routes.html#jd0e270