Configuration Guide Vol. 3


29.1.3 Route selection

From the routing information to a given destination learned by the various protocols, the Switch selects the most appropriate route in accordance with each protocol's independent route selection criteria. If the various protocols generate more than one route to the same destination, the distances are compared and the route with the highest priority is selected.

In BGP4 +, routes learned by using the local protocol to select the best route from routes to the same destination in the order of precedence of route selection. If multiple routes to a given destination are found to exist after route selection by each protocol (RIPng, OSPFv3, and static), their distances are compared and the route with the highest priority is entered in the routing table.

For details about route selection in a confederation configuration, see 29.4.10 Confederations.

Route selection conditions are listed in order of priority as follows:

  1. Selects the route with the greatest weight.

  2. Selects the route with the largest LOCAL_PREF attribute value.

  3. Selects the route whose AS_PATH attribute has the smallest number of ASs.#1

    The AS_SET path type of the AS_PATH attribute is counted as one AS.

  4. Selects by the ORIGIN attribute value, preferring IGP, EGP, and Incomplete, in that order.

  5. Selects the route with the smallest MED attribute value.#2

    Route selection by MED attribute value applies only to redundant routes learned from the same neighboring AS. If bgp always-compare-med of the configuration command is set, duplicate routes learned from different neighboring AS are also enabled.

  6. Selects a route learned by an external peer in preference to a route learned by an internal peer.

  7. Selects the route with the closest next hop (the lowest metric for IGP route used when resolving the next hop).

  8. Selects the route whose peer has the smallest BGP identifier (router ID). For a route having the ORIGINATOR_ID attribute, however, the ORIGINATOR_ID attribute values are compared instead of the peers' BGP identifiers.#3

    If the routes received from an external peer have different peer BGP identifiers (router IDs), the route selected at the previous step is used, and route selection based on peer BGP identifier and learning source peer address is skipped. When the configuration command bgp bestpath compare-routerid is set, routes can be selected using the peer BGP identifier (router ID) even when the peer BGP identifier (router ID) differs between routes received from external peers.

  9. Selects the route with the smallest CLUSTER_LIST attribute length.#4

    When a route does not have the CLUSTER_LIST attribute, it is compared assuming a CLUSTER_LIST attribute length of 0.

  10. Selects the route whose learning source peer has the smallest address.#3

    If the routes received from an external peer have different peer BGP identifiers (router IDs), the route selected at the previous step is used, and route selection based on peer BGP identifier and learning source peer address is skipped. When the configuration command bgp bestpath compare-routerid is set, routes can be selected using the peer BGP identifier (router ID) even when the peer BGP identifier (router ID) differs between routes received from external peers.

Weights and the BGP attributes involved in route selection (the LOCAL_PREF, AS_PATH, ORIGIN, MED, and MP_REACH_NLRI attributes) are explained below.

<Structure of this section>

(1) Weight

A weight is a valuation applied to routes per learning source peer. Routes with higher weights are preferred.

Specify a weight from 0 to 255 for the Switch. The default value is 0.

(a) Changing weight

Using the neighbor weight configuration command, you can change the weight of routes learned from a peer.

(2) LOCAL_PREF Properties

The LOCAL_PREF attribute is reported among routers in the same AS. When there is more than one route to a destination network, the LOCAL_PREF attribute indicates the preferred route. Routes with higher LOCAL_PREF values are preferred.

Specify LOCAL_PREF value from 0 to 65535 that can be used with the Switch. The default value is 100.

(a) Changing the Defaults for LOCAL_PREF Properties

Using the bgp default local-preference configuration command, you can change the LOCAL_PREF attribute value of routing information imported to the Switch from an external peer.

(b) Changing LOCAL_PREF properties on a per-filter basis

Using the set local-preference configuration command in combination with a learned route filter and advertised route filter, you can change the LOCAL_PREF attribute value of routing information imported to the Switch or reported to other switches.

(c) Sample Route Selection Using LOCAL_PREF Properties

The following figure shows route selection using the LOCAL_PREF attribute.

Figure 29-2: Route selection by LOCAL_PREF

[Figure Data]

In the above figure, AS400 receives routing information for network A from AS200 and AS300. Assume that the LOCAL_PREF attribute value of Switch D is set to 150 and that the LOCAL_PREF attribute value of Switch E is set to 50. Thus, a LOCAL_PREF value of 150 would apply when Switch D notifies Switch F of the routing information received from AS200, and a LOCAL_PREF value of 50 would apply when Switch E notifies Switch F of the routing information received from AS300. Of the two sets of network-A routing information destined for Switch F, the routing information from Switch D has a higher LOCAL_PREF value than the routing information from Switch E. Therefore, the routing information from Switch D via AS200 is selected.

(3) ORIGIN Properties

The ORIGIN attribute indicates the source of the routing information. The following table describes the attribute values.

Table 29-2 ORIGIN Attributes

ORIGIN attribute

Description

IGP

The route was generated within the AS.

EGP

The route was learned via EGP.

Incomplete

The route was learned by some other means.

When there are multiple paths to a given destination, the ORIGIN attribute is selected in the order IGP, EGP, and then Incomplete.

(a) Modifying ORIGIN Properties

Using the set origin configuration command in combination with a route filter, you can change the ORIGIN attribute value of routing information imported to the Switch or reported to other switches.

(4) AS_PATH attribute

The AS_PATH attribute is a list of AS numbers that a route traverses to reach the destination network. When routing information is advertised to another AS, the local AS number is added to the AS_PATH attribute in that routing information. Using learning filter information and advertising filter information in combination with the set as-path prepend count configuration command, you can add more than one local AS number to the AS_PATH attribute. This is useful for selecting a specific path when there are a number of routes to a given destination network.

(a) Example of Route Selection by AS_PATH Attribute

The following figure shows route selection using the AS_PATH attribute.

Figure 29-3: Route selection using the AS_PATH attribute

[Figure Data]

Suppose that Router A reports information about network A in its local AS to Switch E. When the routing information reaches AS500, it will have an AS_PATH attribute of "200 100". However, if the routing information is instead directed through AS300 and AS400, the AS_PATH attribute when the routing information reaches AS500 will be "400 300 100". Therefore, Switch E determines that the route via AS200 has the smaller AS_PATH attribute and selects that route.

(b) Route Selection When Using set as-path prepend count Commands

The following figure shows an example of the set as-path prepend count configuration command.

Figure 29-4: Sample Use of set as-path prepend count Commands

[Figure Data]

In the above figure, to force Switch E to select the route from Router A via AS300 and AS400, you need to add multiple local AS numbers to the AS_PATH attribute of the routing information sent from Router A to AS200. For example, if you add three local AS numbers, the AS_PATH attribute when the routing information reaches AS500 via AS200 is "200 100 100 100".Therefore, Switch E determines that the route through AS300 and AS400 has the smaller AS_PATH attribute and selects that route.

(5) MED Properties

The MED attribute determines the priority of multiple BGP4+ routes to a given destination learned from the same neighboring AS. Routes with lower MED attribute values are preferred. Using the bgp always-compare-med configuration command, you can use MED attribute values for priority selection among BGP4+ routes learned from different neighboring ASs.

(a) Sample Route Selection Using MED Properties

The following figure shows route selection using the MED attribute.

Figure 29-5: Route selection by MED attribute

[Figure Data]

Suppose that Router C advertises routing information for a given destination network with a MED attribute value of 10, and Router D advertises routing information to the same network with a MED attribute value of 20. Switch A will therefore select the routing information reported from Router C as the preferred route to the destination network.

(b) Changing MED Properties

Using learned filter information and advertised filter information in combination with the set metric configuration command, you can change the MED attribute value of routing information imported to the Switch or reported to other switches.

By specifying internal in set metric-type, you can set the metric of the IGP route used for next-hop resolution as the MED attribute value of the BGP4+ route to be advertised. The following figure shows an example of using set metric-type internal.

Figure 29-6: Set metric-type internal Usage Examples

[Figure Data]

In the above figure, Switches A and B are internal peers. Suppose that you want to set the metric 2 of the IGP route from Switch B to Switch A as the MED attribute value when the BGP4+ routing information that was reported from Switch A with a MED attribute value of 100 is advertised by Switch B to Router C. You can do so by specifying the set metric configuration command on Switch B.

(6) Next-hop data for MP_REACH_NLRI property

In BGP4+, the value of the NextHop attribute received from a BGP4+ peer is ignored. Instead, the next-hop information in the MP_REACH_NLRI attribute is adopted as the next hop of the route.

In BGP4+, the global address and link-local address (only for external peers) on the local side of the interface used for peering are set for next-hop information in the MP_REACH_NLRI attribute when routing information is reported to a remote BGP4+ speaker.These addresses are set only when IPv6 global addresses are used for peering.

(a) Next hop configuration example

The following figure shows examples of setting the next hop of the reported routing information when advertising a route learned from a BGP4+ peer.

Figure 29-7: Example of setting the next hop of the routing information to be advertised when advertising a route learned from a BGP4 + peer

[Figure Data]

  • Routing information destined for external peer Router B

    The global and link-local addresses Ib on the Switch A side of the interface between Switch A and Router B are assigned as the next hop in the MP_REACH_NLRI attribute. Switch A is not concerned with which address Router B uses as the next hop.

  • Routing information from directly connected external peer Router B

    If the next hop information in the MP_REACH_NLRI attribute contains either the global address or the link-local address, that address is used as the next hop. If both addresses are present, the link-local address is used.

  • Routing information destined for internal peer Router C

    The global address set for the next hop in the MP_REACH_NLRI attribute in the routing information received from Router B is used.

    If no global address is set for the next hop in MP_REACH_NLRI attribute of the routing information received from Router B, the global address of the Switch on the interface between Switch A and Router C is set.

  • Routing information destined for internal peer Router D

    The global address set for the next hop in the MP_REACH_NLRI attribute in the routing information received from Router B is used.

    If no global address is set for the next hop in MP_REACH_NLRI attribute of the routing information received from Router B, the global address of the Switch on the interface between Switch A and Router D is set.

The following figure shows examples of setting the next hop in the routing information that is reported when advertising an IGP route via BGP4+.

Figure 29-8: Example of setting the next hop of the routing information to be advertised when IGP routes are advertised by BGP4+

[Figure Data]

  • Routing information destined for external peer Router C

    The global and link-local addresses Ic on the Switch B side of the interface between Switch B and Router C are set as the next hop in the MP_REACH_NLRI attribute. Switch B is not concerned with which address Router C uses as the next hop.

  • Routing information destined for internal peer Router D

    The interface address Ia of Router A, which is the next-hop address to network A specified by the IGP route, is set as the next hop in the MP_REACH_NLRI attribute. Note, however, that if Ia is a link-local address, the global address Id on the Switch B side of the interface between Switch B and Router D is set as the next hop in the MP_REACH_NLRI attribute.

(b) To change the next hop

Use the following configuration commands to modify the next hop in the MP_REACH_NLRI attribute:

  • neighbor next-hop-self command

    Changes the next hop in the MP_REACH_NLRI attribute used when routing information received from a BGP4+ peer is advertised to BGP4+ peers to the peering address of the local router.This command applies when only the global address is set for the next hop in the MP_REACH_NLRI attribute in the routing information. This command does not apply when using route reflection or when advertising an IGP route to an internal peer by BGP4+.

  • neighbor always-nexthop-self command

    Changes the next hop in the MP_REACH_NLRI attribute used when advertising routing information to an internal peer to the peering address of the local router.This command also applies when using route reflection or when advertising an IGP route by BGP4+.

  • neighbor set-nexthop-peer command

    Changes the next hop in the MP_REACH_NLRI attribute of learned routing information to the remote peer address used for peering.

(c) Next-hop resolution

When BGP4+ routing information has been learned from an internal peer, the path to reach an address indicated by the next-hop information of the MP_REACH_NLRI attribute specified by an IGP route, a static route, or a directly connected route. Among the routes that can reach the next hop of the BGP4+ route, the route having the longest destination mask length is selected and the path of that route is used as the BGP4+ route.

By using the bgp nexthop configuration command, you can specify the protocol type and prefix of the route to be used in resolving the next hop.

If the route to which the next hop resolves is a static route and the noinstall parameter is specified, the BGP4+ route is suppressed.