Routing

Expand all | Collapse all

Static route isn't redistributed by BGP

Jump to Best Answer
  • 1.  Static route isn't redistributed by BGP

    Posted 07-18-2019 06:13

    Isn't static routs advertised by BGP by default?

     

    The neighbour has no export filter on it, only import filter.

    set protocols bgp group N1 neighbor 10.10.10.2
    set protocols bgp group N1 neighbor 10.10.10.2  import IMP-FILTER

    set protocols bgp group N1 neighbor 10.10.10.2 peer-as 12345

     

    But it doesn't redistribute it.

     

    It is advertised on another peer on the same router.  Which has an export filter where it specifies to advertise both bgp and static.

     

    Is this something that is needed? Or is it something else that can block it? (It's a quite massive config)

     

    In case that's the default way it works, would this be enough?

     

    set policy-option policy-statement EXP-FILTER term STAT from protocol bgp
    set policy-option policy-statement EXP-FILTER term STAT from protocol static
    set policy-option policy-statement EXP-FILTER term STAT from protocol the accept

    set protocols bgp group N1 neighbor 10.10.10.2 export

     



  • 2.  RE: Static route isn't redistributed by BGP
    Best Answer

     
    Posted 07-18-2019 06:30

    Hello,

     

    BGP does not redistribute static route by default.

    You have to explicitly add a term for protocol static it in your export policy if you want to redistribute them to the peer.

     

    Therefore it is working for the second peer (where export policy has been applied) but not working for the first one.

     

    The correct way would be to add two seperate terms for each protocol, in case later you want to add more specific route prefixes to each term.

    Eg,

     

    set policy-option policy-statement EXP-FILTER term STAT from protocol static

    set policy-option policy-statement EXP-FILTER term STAT then accept

    set protocols bgp group N1 neighbor 10.10.10.2 export EXP-FILTER

     

    For BGP routes you need not add a term as BGP routes are by default advertised to bgp peer.

     

    I hope this helps

     

    Regards,

    Ankur

    Please accept my response as solution if its solves your query.

     



  • 3.  RE: Static route isn't redistributed by BGP

    Posted 07-22-2019 00:51

    Thanks!

     

    "For BGP routes you need not add a term as BGP routes are by default advertised to bgp peer."
    Is that the case even if I create a filter that specifies that static should be redistributed?



  • 4.  RE: Static route isn't redistributed by BGP

     
    Posted 07-22-2019 01:00

    Thats correct, whatever router is getting from BGP it will advertise and in addition, if you have defined a policy to send static route and exported in BGP then along with BGP routes, static will also be advertised.

     

    Let me know if you any query.



  • 5.  RE: Static route isn't redistributed by BGP

     
    Posted 07-22-2019 03:01
    That's correct, for bgp routes you need not add any term in your export policy, as they will be advertised by default. But for any other protocol eg. Static you will have to explicitly allow them in your export policy to be redistributed. That way along with the bgp routes, the allowed protocol routes will also be advertised to the peer.

    I hope this answers your query.


    Regards,
    Ankur


  • 6.  RE: Static route isn't redistributed by BGP

    Posted 07-18-2019 06:31

    Hi tappe ,

     

    Static routes are not redistributed in bgp by default .In order to redistribute static routes into bgp and also lets say limit to a specific route say 10.10.10.0/24 you can do the below config .

     

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

    set policy-options policy-statement REDISTRIBUTE_STATIC term 1 from route-filter 10.10.10.0/24 prefix-length-range /24-/24 set policy-options policy-statement REDISTRIBUTE_STATIC term 1 then accept

     

    set protocols bgp group N1 neighbor 10.10.10.2 export REDISTRIBUTE_STATIC

     

    BR,

    Avinash

    'Please Mark My Solution Accepted if it Helped, Kudos are also welcome'



  • 7.  RE: Static route isn't redistributed by BGP

     
    Posted 07-18-2019 07:00

    Hi tappe,

     

    Static routes are not redistributed by default on BGP and this is true per the accepted standard.

     

    There perhaps is a policy for the other peer that seems to be receiving advertisements.

     

    Can you share the output of 'show route advertising-protocol bgp <neighbor-receiving-static>' ?

     

    Cheers

    Pooja

     

     



  • 8.  RE: Static route isn't redistributed by BGP

     
    Posted 07-18-2019 12:49

    I am actually quite interested in why you would think static (default) route is being redistributed into BGP by default? 

    Is it some vendor's implementation or your ISP always advertise static (default) route? From where you read, you are under this impression? 



  • 9.  RE: Static route isn't redistributed by BGP

     
    Posted 07-18-2019 20:25
    Hi Tappe, If you are wondering whether Juniper has something similar to "network" command like other vendor that will advertise the routes without any BGP export policy , the answer is NO. By default eBGP will advertise all routes received from iBGP or eBGP peer and iBGP will advertise the routes received from eBGP peer. In order to advertise any other route direct/static/ospf/rip to BGP peer you will need an export policy. Please mark my response as solution if it answers your query! Thanks Vishal