This article provides steps on how to apply ECMP for BGP sessions when the interface hosting BGP is inside a routing-instance.
The tunnel interfaces are a part of routing-instances. Hence, the routes are learned in the routing-table of the routing-instance and not the default routing-table.
root@jtac> show route 172.25.0.0/18 routing_instance1.inet.0: 12 destinations, 24 routes (12 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 172.25.0.0/18 *[BGP/170] 00:00:09, localpref 100 AS path: 200 I, validation-state: unverified > to 169.254.77.45 via st0.404 [BGP/170] 00:00:01, localpref 100 AS path: 200 I, validation-state: unverified > to 169.254.193.125 via st0.406 [BGP/170] 00:00:05, localpref 100 AS path: 200 I, validation-state: unverified > to 169.254.214.125 via st0.405
root@jtac> show route forwarding-table matching 172.25.0.0/18 Routing table: routing_instance1.inet Internet: Destination Type RtRef Next hop Type Index NhRef Netif 172.25.0.0/18 user 0 169.254.77.0 ucst 1371 4 st0.404
For this type of scenario, the below statement is not valid, we do not get the "export" option
set routing-instance routing_instance1 routing-options forwarding-table export load-balancing-policy root@jtac# set routing-instances routing_instance1 routing-options forwarding-table ? Possible completions: + apply-groups Groups from which to inherit configuration data + apply-groups-except Don't inherit configuration data from these groups > ip-tunnel-rpf-check IP tunnel Reverse Path Forwarding Check unicast-reverse-path Unicast reverse path (RP) verification
By default, if the policy-options are applied without the instance, they will be applied on all the routing-tables of all the routing-instances configured.But, the load-balancing will work as expected.
However, if there are any routes in routing-instances to the same destination subnet where load-balance is not required, the load-balancing will be applied unnecessarily.To avoid this, we need to add the below statement when configuring the policy-options:set policy-options policy-statement load-balancing-policy from instance routing_instance1The policy options would look like this:set policy-options policy-statement load-balancing-policy from instance routing_instance1set policy-options policy-statement load-balancing-policy from route-filter 198.20.0.0/18 orlongerset policy-options policy-statement load-balancing-policy from route-filter 198.100.0.0/15 orlongerset policy-options policy-statement load-balancing-policy from route-filter 198.25.0.0/18 orlongerset policy-options policy-statement load-balancing-policy from route-filter 198.64.0.0/15 orlongerset policy-options policy-statement load-balancing-policy then load-balance per-packetset routing-options forwarding-table export load-balancing-policy