Examine BGP Routes and Route Selection
Purpose
You can examine the BGP path selection process to determine the single, active path when BGP receives multiple routes to the same destination prefix.
![]()
The network in Figure 16 shows that
R1andR5announce the same aggregate routes toR2andR4,which results inR2andR4receiving two routes to the same destination prefix. The route selection process onR2andR4determines which of the two BGP routes received is active and advertised to the other internal routers (R3andR6).Before the router installs a BGP route, it must make sure that the BGP
next-hopattribute is reachable. If the BGP next hop cannot be resolved, the route is not installed. When a BGP route is installed in the routing table, it must go through a path selection process if multiple routes exist to the same destination prefix. The BGP path selection process proceeds in the following order:
- Route preference in the routing table is compared. For example, if an OSPF and a BGP route exist for a particular destination, the OSPF route is selected as the active route because the OSPF route has a default preference of 10, while the BGP route has a default preference of 170.
- Routes are compared for local preference. The route with the highest local preference is preferred. For example, see Examine the Local Preference Selection.
- The AS path attribute is evaluated. The shorter AS path is preferred.
- The origin code is evaluated. The lowest origin code is preferred (
I (IGP) < E (EGP) < ? (Incomplete)).- The MED value is evaluated. By default, if any of the routes are advertised from the same neighboring AS, the lowest MED value is preferred. The absence of a MED value is interpreted as a MED of 0. For an example, see Examine the Multiple Exit Discriminator Route Selection.
- The route is evaluated as to whether it is learned through EBGP or IBGP. EBGP learned routes are preferred to IBGP learned routes. For an example, see Examine the EBGP over IBGP Selection
- If the route is learned from IBGP, the route with the lowest IGP cost is preferred. For an example, see Examine the IGP Cost Selection. The physical next hop to the IBGP peer is installed according to the following three rules:
- After BGP examines the
inet.0andinet.3routing tables, the physical next hop of the route with the lowest preference is used.- If the preference values in the
inet.0and theinet.3routing tables are a tie, the physical next hop of the route in theinet.3routing table is used.- When a preference tie exists in the same routing table, the physical next hop of the route with more paths is installed.
- The route reflection cluster list attribute is evaluated. The shortest length cluster list is preferred. Routes without a cluster list are considered to have a cluster list length of 0.
- The router ID is evaluated. The route from the peer with the lowest router ID is preferred (usually the loopback address).
- The peer address value is examined. The peer with the lowest peer IP address is preferred.
Steps To Take
To determine the single, active path when BGP receives multiple routes to the same destination prefix, enter the following JUNOS CLI operational mode command:
user@host>show routedestination-prefix< detail >The following steps illustrate the inactive reason displayed when BGP receives multiple routes to the same destination prefix and one route is selected as the single, active path: