SRX

Expand all | Collapse all

How to advertise static routes in BGP

  • 1.  How to advertise static routes in BGP

    Posted 10-06-2017 11:04

    I will have a /24 routed to me over bgp, and I would like to subnet and statically route the /24 to various interfaces from my SRX340 in packet mode. 

     

    I have set up an aggregation policy so that when any contingent part of the /24 is active (/24 orlonger), it advertises the entire /24 over BGP to my neighbours as per my export policy. 

     

    I am having trouble keeping the route active when I don't either have part of it static to "discard", part of it active on an interface, or one of the addresses attached to the loopback interface. 

     

    If I would like to route any part of the /24 statically to other addresses that are not part of that subnet, none of them will be "active" on the SRX, and it won't advertise the /24 over bgp. How can I correct this? I have tried advertise-inactive as well but I don't think I either understood it or got it to work. 

     

    Thanks for the help! 



  • 2.  RE: How to advertise static routes in BGP

     
    Posted 10-06-2017 15:05

    I am not positive I follow you questions so forgive me if this is the wrong answer.

     

    I think you want to always advertise your /24 even when there are no contributing routes active in your routing table to keep it active with your upstream peer.

     

    For this I generally create a static discard route for the entire /24.  The discard routes always remain active even without contributing routes and will match your upstream export policy to keep the advertisment alive.

     

    naturally if there are no contributing routes, once that traffic does arrive it will be discarded and blackholed until those routes are restored.



  • 3.  RE: How to advertise static routes in BGP

    Posted 10-07-2017 15:46

    Am I able to keep both the discard route for the /24 as well as more specific static routes that are subnetted from the /24 in the routing table at the same time? The presence of both doesn't override anything? 

     

    Example: 

     

    routing-options
      static {
        route 192.168.100.0/30 next-hop 10.0.0.2;
        route 192.168.100.128/25 next-hop 172.20.20.2;
        route 192.168.100.0/24 discard;
    

    Whereas the static routes get where they need to go, but anything within the /24 of 192.168.100.0 that does not have a static route gets blackholed? 

     

    Just want to make sure the discard wouldn't take any priority over a static route. Does the order they are listed in have any effect on the order they are processed in? i.e. list discard AFTER static? 



  • 4.  RE: How to advertise static routes in BGP

    Posted 10-08-2017 05:06

    Likewise... 

     

    If I hand a connected device a /24 and I take address .1 from that, but the interface is down - I still want to advertise that /24. To prevent route flapping, so that it isn't withdrawn from my BGP announcement, what is the best practice? 

     

    Do I statically route a "discard" for the /24, then when the interface is up it takes priority in the table and starts working, or is there a better/preferred solution? 



  • 5.  RE: How to advertise static routes in BGP

     
    Posted 10-08-2017 05:19

    The static discard route will allow the /24 to always be in the table even when the connected or learned routes are down.

     

    routing-options
      static {
        route 192.168.100.0/30 next-hop 10.0.0.2;
        route 192.168.100.128/25 next-hop 172.20.20.2;
        route 192.168.100.0/24 discard;

    In the above example all will work as desired because the more specific routes will send live traffic while the discard route has the /24 present to advertise.  This is a pretty typical scenario where we advertise a large prefix to upstreams via the discard route and allocate smaller segments to downstream connections that are routed as they are available.

     

    There is also no issue if your /24 is a connected route, this will trump the static discard when it is available and the discard will keep the route advertised when not.

     

    If you are learning the /24 from a protocol then you would need to adjust the static discard metric to be less prefered than the learned route to be sure it functions as desired.