Routing

Expand all | Collapse all

Static route through BGP

Jump to Best Answer
  • 1.  Static route through BGP

    Posted 09-09-2019 09:38

    Hello all,

     

    Couple of questions. We currently have a /26 with our ISP that connects to them via BGP with the ISP's provided ASN. We received a /24 from the same ISP with our own ASN and we will eventually remove the /26. For now the /26 needs to remain in service.

     

    I know you cannot advertise both the /24 and /26 via BGP to the same ISP peer using different AS numbers. What the ISP told us is that we can advertise the /24 via BGP and statically route the /26 through them.  Do I only need to define the static /26 through policy-options, export it through BGP and define it on an interface?

     

    Also, do I need the term 1 statement? Our current edge router was programmed before I arrived and has always had that line (when it was only the /26).

     

    policy-options {
        policy-statement bgp-export {
            term 1 {
                from {
                    protocol direct;
                    route-filter 2.2.2.0/24 exact;
                }
                then accept;
            }
            term 2 {
                from {
                    protocol static;
                    route-filter 3.3.3.64/26 exact;
                }
                then accept;
            }
        }
    }
    
    protocols {
        bgp {
            group isp {
                type external;
                local-address 4.4.4.246;
                export bgp-export;
                peer-as 8888;
                local-as 99999;
                neighbor 4.4.4.245;
            }
        }
    }
    
    interfaces {
        reth0 {
            per-unit-scheduler;
            mtu 1514;
            redundant-ether-options {
                redundancy-group 1;
            }
            unit 0 {
                family inet {
                    address 4.4.4.246/30;
                }
            }
        }
        reth1 {
            redundant-ether-options {
                redundancy-group 1;
            }
            unit 0 {
                family inet {
                    address 2.2.2.1/24 {
                        primary;
                    }
                    address 3.3.3.65/26;
                }
            }
        }
    }


  • 2.  RE: Static route through BGP

     
    Posted 09-09-2019 17:56

    Hello

    Do you have the 2.2.2.0/24 route as a direct route on the local router("show route 2.2.2.0" displays [Direct])? If so, it makes sense to configure term 1. 

    "Do I only need to define the static /26 through policy-options, export it through BGP and define it on an interface"

    I did not understand the static and define on interface requirement. Is this /26 route already present in show route output? 

    The static route configuration is as follows

    https://www.juniper.net/documentation/en_US/junos/topics/topic-map/policy-static-routing.html

    But this is needed only if the route is not present already in the local router. 

     



  • 3.  RE: Static route through BGP

    Posted 09-10-2019 01:44

    Hello,

     


    @knightmese wrote:

    What the ISP told us is that we can advertise the /24 via BGP and statically route the /26 through them. 

     

    What Your ISP likely means is that ISP needs to define a static /26 route to point to Your border router' interface IP.

    You don't point the route for an IP block You own to the upstream/ISP.

     

     


    @knightmese wrote:

    only need to define the static /26 through policy-options, export it through BGP and define it on an interface?

    if Your ISP uses a static /26 route to send traffic back to You, You don't need to do anything at all.

     

    HTH

    Thx
    Alex

     



  • 4.  RE: Static route through BGP

    Posted 09-10-2019 09:26

    @aarseniev wrote:

     

    What Your ISP likely means is that ISP needs to define a static /26 route to point to Your border router' interface IP.

    You don't point the route for an IP block You own to the upstream/ISP.

     



    Hi Alex,

     

    I didn't word that very well.  I'm wondering how the /26 knows to route through to the ISP.  If it was just the /26 and no BGP, I would add a static route saying 0.0.0.0 then go to 4.4.4.245.  I'm new to BGP so if I add it as a secondary IP on the interface, does it just know to inject it into the route table?

     

    This is not something I have in production at the moment so I'm not able to check a live routing table.



  • 5.  RE: Static route through BGP
    Best Answer

     
    Posted 09-10-2019 10:37

    You will have to export to BGP if it is a non-BGP route. If you dont have the specific route but contributing routes, you can think of aggregating the route as in the example below

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

    Btw, configured IP on the interface will be a direct route; so you will have to modify policy with that.

    set policy-options policy-statement send-direct term 1 from protocol direct
    set policy-options policy-statement send-direct term 1 from route-filter x.x.x.x/XX exact
    set policy-options policy-statement send-direct term 1 then accept


  • 6.  RE: Static route through BGP

    Posted 09-10-2019 11:52

    Thank you Alex and Shijot!