S9300 and S9300E V200R008(C00&C10) Configuration Guide - IP Unicast Routing

This document describes IP Unicast Routing configurations supported by the switch, including the principle and configuration procedures of IP Routing Overview, Static Route, RIP, RIPng, OSPF, OSPFv3, IS-IS(IPv4), IS-IS(IPv6), BGP, Routing Policy ,and PBR, and provides configuration examples.

BGP Route Selection Rules and Load Balancing

BGP Route Selection Rules and Load Balancing

There may be multiple routes to the same destination in a BGP routing table. BGP will select one route as the optimal route and advertise it to peers. To select the optimal route among these routes, BGP compares the BGP attributes of the routes in sequence based on route selection rules.

BGP Attributes

Route attributes describe routes. BGP route attributes are classified into the following types. Table 9-1 lists common BGP attributes.

  • Well-known mandatory attribute

    All BGP devices can identify this type of attributes, which must be carried in Update messages. Without this type of attributes, errors occur in routing information.

  • Well-known discretionary attribute

    All BGP devices can identify this type of attributes, which are optional in Update messages. Without this type of attributes, errors do not occur in routing information.

  • Optional transitive attribute

    BGP devices may not identify this type of attributes but still accepts them and advertises them to peers.

  • Optional non-transitive attribute

    BGP devices may not identify this type of attributes. If a BGP device does not identify this type of attributes, it ignores them and does not advertise them to peers.

Table 9-1  Common BGP attributes
Attribute Type
Origin Well-known mandatory
AS_Path Well-known mandatory
Next_Hop Well-known mandatory
Local_Pref Well-known discretionary
Community Optional transitive
MED Optional non-transitive
Originator_ID Optional non-transitive
Cluster_List Optional non-transitive

The following describes common BGP route attributes:

  • Origin

    The Origin attribute defines the origin of a route and marks the path of a BGP route. The Origin attribute is classified into three types:

    • IGP

      A route with IGP as the Origin attribute is of the highest priority. The Origin attribute of the routes imported into a BGP routing table using the network command is IGP.

    • EGP

      A route with EGP as the Origin attribute is of the secondary highest priority. The Origin attribute of the routes obtained through EGP is EGP.

    • Incomplete

      A route with Incomplete as the Origin attribute is of the lowest priority. The Origin attribute of the routes learned by other means is Incomplete. For example, the Origin attribute of the routes imported by BGP using the import-route command is Incomplete.

  • AS_Path

    The AS_Path attribute records all the ASs that a route passes through from the source to the destination in the vector order. To prevent inter-AS routing loops, a BGP device does not receive the routes of which the AS_Path list contains the local AS number.

    When a BGP speaker advertises an imported route:

    • If the route is advertised to EBGP peers, the BGP speaker creates an AS_Path list containing the local AS number in an Update message.

    • If the route is advertised to IBGP peers, the BGP speaker creates an empty AS_Path list in an Update message.

    When a BGP speaker advertises a route learned in the Update message sent by another BGP speaker:

    • If the route is advertised to EBGP peers, the BGP speaker adds the local AS number to the leftmost of the AS_Path list. According to the AS_Path list, the BGP speaker that receives the route can learn about the ASs through which the route passes to reach the destination. The number of the AS that is nearest to the local AS is placed on the top of the AS_Path list. The other AS numbers are listed according to the sequence in which the route passes through ASs.

    • If the route is advertised to IBGP peers, the BGP speaker does not change the AS_Path attribute of the route.

  • Next_Hop

    The Next_Hop attribute records the next hop that a route passes through. The Next_Hop attribute of BGP is different from that of an IGP because it may not be the neighbor IP address. A BGP speaker processes the Next_Hop attribute based on the following rules:

    • When advertising a route to an EBGP peer, a BGP speaker sets the Next_Hop attribute of the route to the address of the local interface through which the BGP peer relationship is established with the peer.

    • When advertising a locally originated route to an IBGP peer, the BGP speaker sets the Next_Hop attribute of the route to the address of the local interface through which the BGP peer relationship is established with the peer.

    • When advertising a route learned from an EBGP peer to an IBGP peer, the BGP speaker does not change the Next_Hop attribute of the route.

  • Local_Pref

    The Local_Pref attribute indicates the BGP preference of a device and helps determine the optimal route when traffic leaves an AS. When a BGP device obtains multiple routes to the same destination address but with different next hops from different IBGP peers, the BGP device prefers the route with the highest Local_Pref. The Local_Pref attribute is exchanged only between IBGP peers and is not advertised to other ASs. The Local_Pref attribute can be manually configured. If no Local_Pref attribute is configured for a route, the Local_Pref attribute of the route uses the default value 100.

  • MED

    The multi-exit discriminator (MED) attribute helps determine the optimal route when traffic enters an AS. When a BGP device obtains multiple routes to the same destination address but with different next hops from EBGP peers, the BGP device selects the route with the smallest MED value as the optimal route.

    The MED attribute is exchanged only between two neighboring ASs. The AS that receives the MED attribute does not advertise it to any other ASs. The MED attribute can be manually configured. If no MED attribute is configured for a route, the MED attribute of the route uses the default value 0.

  • Community

    The Community attribute identifies the BGP routes with the same characteristics, simplifies the applications of routing policies, and facilitates route maintenance and management.

    The Community attribute includes self-defined community attributes and well-known community attributes. Table 9-2 lists well-known community attributes.

    Table 9-2  Well-known community attributes

    Community Attribute

    Value

    Description

    Internet

    0 (0x00000000)

    A BGP device can advertise the received route with the Internet attribute to all peers.

    No_Advertise

    4294967042 (0xFFFFFF02)

    A BGP device does not advertise the received route with the No_Advertise attribute to any peer.

    No_Export

    4294967041 (0xFFFFFF01)

    A BGP device does not advertise the received route with the No_Export attribute to devices outside the local AS.

    No_Export_Subconfed

    4294967043 (0xFFFFFF03)

    A BGP device does not advertise the received route with the No_Export_Subconfed attribute to devices outside the local AS or to devices outside the local sub-AS.

  • Originator_ID and Cluster_List

    The Originator_ID attribute and Cluster_List attribute help eliminate loops in route reflector scenarios. For details, see Route Reflector.

BGP Route Selection Policies

When there are multiple routes to the same destination, BGP compares the following attributes in sequence to select the optimal route:

  1. Prefers the route with the largest PrefVal value.

    The PrefVal attribute is a Huawei proprietary attribute and is valid only on the device where it is configured.

  2. Prefers the route with the highest Local_Pref.

    If a route does not have the Local_Pref attribute, the Local_Pref attribute of the route uses the default value 100.

  3. Prefers the manually summarized route, automatically summarized route, route imported using the network command, route imported using the import-route command, and route learned from peers. These routes are in descending order of priority.

  4. Prefers the route with the shortest AS_Path.

  5. Prefers the route with the lowest origin type. IGP is lower than EGP, and EGP is lower than Incomplete.

  6. Prefers the route with the lowest MED if routes are received from the same AS.

  7. Prefers EBGP routes, IBGP routes, LocalCross routes, and RemoteCross routes, which are listed in descending order of priority.

    LocalCross allows a PE to add the VPNv4 route of a VPN instance to the routing table of the VPN instance if the export RT of the VPNv4 route matches the import RT of another VPN instance on the PE. RemoteCross allows a local PE to add the VPNv4 route learned from a remote PE to the routing table of a VPN instance on this local PE if the export RT of the VPNv4 route matches the import RT of the VPN instance.

  8. Prefers the route with the lowest IGP metric to the BGP next hop.

    If there are multiple routes to the same destination, an IGP calculates the route metric using its routing algorithm.

    After the bestroute igp-metric-ignore command is run, the IGP metrics are not compared for routes during route selection.

  9. Prefers the route with the shortest Cluster_List.

    By default, Cluster_List takes precedence over Originator_ID during BGP route selection. To enable Originator_ID to take precedence over Cluster_List during BGP route selection, run the bestroute routerid-prior-clusterlist command.
  10. Prefers the route advertised by the device with the smallest router ID.

    If a route carries the Originator_ID attribute, BGP prefers the route with the smallest Originator_ID without comparing the router ID.

  11. Prefers the route learned from the peer with the lowest IP address.

BGP Load Balancing

When there are multiple equal-cost routes to the same destination, you can perform load balancing among these routes to load balance traffic. Equal-cost BGP routes can be generated for traffic load balancing only when the first eight route attributes described in "BGP Route Selection Policies" are the same.