Cisco BGP-4 Command and Configuration Handbook

 <  Free Open Study  >  

Routes learned via BGP have associated properties that are used to determine the best route to a destination when multiple paths exist. These properties are called BGP attributes. An under-standing of how BGP attributes influence route selection is required for the design of robust networks. This section describes the attributes that BGP uses in the route selection process:

  • Weight

  • Local preference

  • Multi-exit discriminator

  • Origin

  • AS_path

  • Next -hop

  • Community

Weight Attribute

Weight is a Cisco-defined attribute that is local to a router. The weight attribute is not advertised to neighboring routers. If the router learns about more than one route to the same destination, the route with the highest weight is preferred. In Figure A-2, Router A is receiving an advertisement for network 172.16.1.0 from Routers B and C. When Router A receives the advertisement from Router B, the associated weight is set to 50. When Router A receives the advertisement from Router C, the associated weight is set to 100. Both paths for network 172.16.1.0 will be in the BGP routing table with their respective weights. The route with the higher weight will be installed in the IP routing table.

Figure A-2. BGP Weight Attribute

Local Preference Attribute

The local preference attribute is used to prefer an exit point from the local autonomous system. Unlike the weight attribute, the local preference attribute is propagated throughout the local AS. If there are multiple exit points from the AS, the local preference attribute is used to select the exit point for a specific route. In Figure A-3, AS 100 is receiving two advertisements for network 172.16.1.0 from AS 200. When router A receives the advertisement for network 172.16.1.0, the corresponding local preference is set to 50. When router B receives the advertisement for network 172.16.1.0, the corresponding local preference is set to 100. These local preference values are exchanged between routers A and B. Because router B has a higher local preference than router A, router B is used as the exit point from AS 100 to reach network 172.16.1.0 in AS 200.

Figure A-3. BGP Local Preference Attribute

Multi-Exit Discriminator Attribute

The multi-exit discriminator (MED) or metric attribute is used as a suggestion to an external AS regarding the preferred route into the AS that is advertising the metric.

I say "suggestion" because the external AS that is receiving the MEDs might be using other BGP attributes for route selection. We will cover the rules of route selection in the next section. In Figure A-4, Router C is advertising the route 172.16.1.0 with a metric of 10, and Router D is advertising 172.16.1.0 with a metric of 5. The lower value of the metric is preferred, so AS 100 selects the route to router D for network 172.16.1.0 in AS 200. MEDs are advertised throughout the local AS.

Figure A-4. BGP Multi-Exit Discriminator Attribute

Origin Attribute

The origin attribute indicates how BGP learned about a particular route. The origin attribute can have one of three possible values:

  • IGP ” The route is interior to the originating AS. This value is set when the network router configuration command is used to inject the route into BGP.

  • EGP ” The route is learned via the Exterior Gateway Protocol (EGP).

  • Incomplete ” The origin of the route is unknown or is learned some other way. An origin of Incomplete occurs when a route is redistributed into BGP.

The origin attribute is used for route selection. It is covered in the next section.

AS_path Attribute

When a route advertisement passes through an autonomous system, the AS number is added to an ordered list of AS numbers that the route advertisement has traversed. Figure A-5 shows a situation in which a route is passing through three autonomous systems.

Figure A-5. BGP AS_Path Attribute

AS1 originates the route to 172.16.1.0 and advertises this route to AS 2 and AS 3 with the AS_path attribute equal to {1}. AS 3 advertises back to AS 1 with AS_path attribute {3,1}, and AS 2 advertises back to AS 1 with AS_path attribute {2,1}. AS 1 rejects these routes when its own AS number is detected in the route advertisement. This is the mechanism that BGP uses to detect routing loops . AS 2 and AS 3 propagate the route to each other, with their AS number added to the AS_path attribute. These routes will not be installed in the IP routing table, because AS 2 and AS 3 are learning a route to 172.16.1.0 from AS 1 with a shorter AS- path list.

Next-Hop Attribute

The EBGP next-hop attribute is the IP address that is used to reach the advertising router. For EBGP peers, the next-hop address is the IP address of the connection between the peers. For IBGP, the EBGP next-hop address is carried into the local AS, as shown in Figure A-6.

Figure A-6. BGP Next-Hop Attribute

Router C advertises network 172.16.1.0 with a next hop of 10.1.1.1. When Router A propagates this route within its own AS, the EBGP next-hop information is preserved. If router B does not have routing information regarding the next hop, the route is discarded. Therefore, it is important to have an IGP running in the AS to propagate next-hop routing information.

Community Attribute

The community attribute provides a way of grouping destinations, called communities, to which routing decisions (such as acceptance, preference, and redistribution) can be applied. Route maps are used to set the community attribute. The predefined community attributes are as follows :

  • no-export ” Do not advertise this route to EBGP peers.

  • no-advertise ” Do not advertise this route to any peer.

  • internet ” Advertise this route to the Internet community; all routers in the network belong to it.

Figure A-7 illustrates the no-export community. AS 1 advertises 172.16.1.0 to AS 2 with the community attribute no-export. AS 2 propagates the route throughout AS 2 but does not send this route to AS 3 or to any other external AS.

Figure A-7. BGP No-Export Community Attribute

In Figure A-8, AS 1 advertises 172.16.1.0 to AS 2 with the community attribute no-advertise. Router B in AS 2 does not advertise this route to any other router.

Figure A-8. BGP No-Advertise Community Attribute

Figure A-9 demonstrates the internet community attribute. There are no limitations to the scope of the route advertisement from AS 1.

Figure A-9. BGP Internet Community Attribute

BGP attributes are classified as either well-known or optional. Well-known attributes are further classified as mandatory or discretionary. A well-known mandatory attribute must be present in the BGP UPDATE message. A well-known discretionary attribute must be recognized by all BGP speakers , but its presence in an UPDATE message is optional. Table A-1 lists the well-known BGP attributes.

Table A-1. Well-Known BGP Attributes

Attribute Type
Origin Mandatory
AS_path Mandatory
Next-hop Mandatory
Local-pref Discretionary
Atomic-aggregate Discretionary

Optional attributes are either transitive or nontransitive. If an optional attribute is not known by the receiving BGP speaker, the BGP speaker determines whether the attribute is transitive or nontransitive by examining a bit in the UPDATE message. If the attribute is transitive, the BGP speaker passes the attribute to other BGP speakers. If the attribute is nontransitive, the attribute is discarded and is not advertised to other BGP speakers. Table A-2 lists the optional BGP attributes.

Table A-2. Optional BGP Attributes

Attribute Type
MED Nontransitive
Originator ID Nontransitive
Cluster list Nontransitive
Aggregator Transitive
Community Transitive
 <  Free Open Study  >  

Категории