Configuration Guide Vol. 3


13.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.

BGP4 selects the best route according to the order of precedence for route selection from routes to the same destination learned using the local protocol. If multiple routes to a given destination are found to exist after route selection by each protocol (RIP, OSPF, 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 13.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 NEXT_HOP attributes) are explained below.

<Structure of this section>

(1) Weight

A weight is a valuation applied to routes per learning source peer.It is set using the neighbor weight configuration command. 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 13-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 13-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 13-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 13-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 13-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 13-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-type internal configuration command on Switch B.

(6) NEXT_HOP attribute

The NEXT_HOP attribute is the IP address of the next hop used to reach a given destination network. In the Switch, the local IP address used for peering is set in the NEXT_HOP attribute when reporting routing information to an external peer. When reporting routing information to an internal peer and member AS peer, the NEXT_HOP attribute is not modified.

(a) Example of Setting the NEXT_HOP Attribute

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

Figure 13-7: Example of setting the NEXT_HOP attribute for the routing information to be notified when advertising routes learned from BGP4 peers

[Figure Data]

  • Routing information destined for external peer Router B

    The NEXT_HOP attribute is the interface address Ib on the A side of the interface between Switch A and Router B.

  • Routing information destined for internal peer Router C

    The NEXT_HOP attribute is the attribute set in the routing information received from Router B.

  • Routing information destined for internal peer Router D

    The NEXT_HOP attribute is the attribute set in the routing information received from Router B.

The following figure shows examples of setting the NEXT_HOP attribute of the reported routing information when advertising an IGP route via BGP4.

Figure 13-8: Example of setting the NEXT_HOP attribute for the routing information to be notified when IGP routes are advertised by BGP4

[Figure Data]

  • Routing information destined for external peer Router C

    The NEXT_HOP attribute is the interface address Ic on the B side of the interface between Switch B and Router C.

  • Routing information destined for internal peer Router D

    The NEXT_HOP attribute is the interface address Ia of Router A, which is the next-hop address to network A resolved to the IGP route.

(b) When replacing the NEXT_HOP attribute

Use the following configuration commands to modify the NEXT_HOP attribute in the Switch:

  • neighbor next-hop-self command

    Changes the NEXT_HOP attribute that is used when routing information received from a BGP4 peer is advertised to another BGP4 peer; the attribute is changed to the peering address of the local router. 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 attribute that is used when routing information is advertised to an internal peer; the attribute is changed 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 attribute of learned routing information to the remote peer address used for peering.

(c) Resolving the NEXT_HOP attribute

When BGP4 routing information has been learned from an internal peer, the path to reach an address indicated by the NEXT_HOP attribute resolves to 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 attribute.

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