Table of Contents
What is the BGP Well Known Mandatory Attributes?
Various path attributes are added to the route information advertised in BGP. Path attributes allow you to select the best path for BGP and control the routing between ASes.
The Well known Mandatory attribute is the most basic path attribute that must be added to any BGP route. The following three path attributes of the Well known Mandatory are explained below.
An ORIGIN attribute is a path attribute that indicates the source of a BGP route, and there are three types.
The ORIGIN attribute of IGP indicates that the BGP route is generated from an IGP in the AS. On the BGP table, the ORIGIN attribute of the IGP is represented by an “i”. Recall that the network in the AS can be routed by IGP The BGP route to which the ORIGIN attribute of IGP is attached is the network of the AS to which the generated router belongs. And it indicates that it is routable within that AS. Almost all BGP routes have IGP appended as their ORIGIN.
On the Cisco router, the ORIGIN attribute of the IGP is appended to the BGP route generated by the network command and the aggregate-address command.
The ORIGIN attribute of EGP indicates that the BGP route is generated from the Exterior Gateway Protocol (EGP), a predecessor protocol to BGP that is no longer used, represented by the letter “e” in the BGP table. It is safe to assume that there is no BGP route where ORIGN is EGP.
The ORIGIN attribute of Incomplete indicates that the source of the BGP route is unknown and is represented by a “?” on the BGP table. On Cisco routers, the ORIGIN attribute of Incomplete is added to the BGP route generated by the redelivery. However, it is not desirable to advertise to other ASes with the Incomplete ORIGIN attribute that is not known to the origin of the route. It is common to change to the ORIGIN attribute of the IGP.
The AS_PATH attribute is a string that represents the list of AS numbers that the BGP route has traversed. The initial AS_PATH attribute is empty when you create a BGP route with, for example, the network command. When advertising a BGP route to an EBGP neighbor that is a neighbor of another AS, it adds its own AS number to the left side of the AS_PATH attribute, and this addition to the left side of the AS_PATH attribute is specifically called “prepend”. Because of this prepend behavior of the AS_PATH attribute, the AS number at the right end of the AS_PATH attribute is considered to be the AS from which the route was generated.
When you advertise a BGP route to an IBGP neighbor, the AS_PATH attribute is unchanged. The following figure shows how the AS_PATH attribute is prepped.
This figure shows how the AS_PATH attribute is modified for the route information of 18.104.22.168/8 in AS1.
The initial AS_PATH attribute is empty; when advertising 22.214.171.124/8 from AS1 to an EBGP neighbor in AS2, the AS number “1” is prepended; when advertising to an IBGP neighbor in AS2, the AS_PATH of 126.96.36.199/8 The attribute remains unchanged; when advertising 188.8.131.52/8 from AS2 to the EBGP neighbor of AS3, the AS number “2” is prepended and the AS_PATH attribute is “2 1”.
BGP is sometimes referred to as a “path vector” routing protocol. This means that the AS_PATH attribute will determine the shortest route as the best path if no special changes are made to the path attribute.
The AS_PATH attribute also plays an important role in preventing BGP routes from looping. A route with its own AS number in the AS_PATH attribute of a received BGP route is considered to be a loop and is discarded.
In BGP, it is fundamental to consider route information in terms of AS units. Therefore, the AS_PATH attribute, which lists the number of ASes that the BGP route came through, is an important attribute. It is often used as a reference point for filtering routes and adding other path attributes.
To control BGP routes by referring to the AS_PATH attribute, a special access list called the AS_PATH access list is used. The AS_PATH access list takes advantage of the fact that the AS_PATH attribute is a string; by specifying the pattern of the AS_PATH attribute as a regular expression, you can identify the route information in terms of the AS_PATH attribute.
The NEXT_HOP attribute, as the name implies, indicates the next-hop address for the route. Note, however, that BGP considers route information in terms of AS units. Depending on the neighbor that advertises the BGP route, the NEXT_HOP attribute is handled differently.
When you generate a BGP route, the initial NEXT_HOP attribute is the next-hop address in your routing table. Then, when you advertise a BGP route to an EBGP neighbor, you change the NEXT_HOP attribute to your own IP address to advertise it. This IP address is the IP address that makes up the neighbor.
In addition, the NEXT_HOP attribute will not be changed in the following cases.
- When advertising a BGP route to EBGP neighbors on a multi-access network
- When advertising the BGP route to IBGP neighbors
The reason why the NEXT_HOP attribute is not changed in case 1. is because of the efficiency of the actual routing of IP packets. Consider the following diagram.
In the figure, R1(AS1), R2(AS2) and R3(AS3) are connected to the same network via Ethernet. the EBGP neighbors are configured between R1(AS1)-R2(AS2) and R2(AS2)-R3(AS3). advertise 184.108.40.206/8 from R2 to R3. If you change the NEXT_HOP attribute to 10.0.0.2 of R2, the actual routing of IP packets will not be efficient, since it is more efficient to route packets from R3 directly to R1. Therefore, when you advertise a BGP route to an EBGP neighbor on the same network as the IP address of the NEXT_HOP attribute, you do not change the NEXT_HOP attribute.
The reason for case 2. is that BGP considers route information in terms of AS. The NEXT_HOP attribute is not changed by default when you advertise a BGP route to an IBGP neighbor, as shown in the following figure.
The NEXT_HOP attribute is the forwarding destination when routing IP packets. Therefore, IP packets cannot be routed if the IP address of the NEXT_HOP attribute cannot be reached. Therefore, you need to be able to reach the NEXT_HOP attribute as a prerequisite for using a BGP route.