BGP attributes – Sass Learns https://sassenachlearns.com/ Sat, 08 Jul 2023 14:41:02 +0000 en-US hourly 1 https://wordpress.org/?v=6.2.2 BGP Route Reflectors (RR) – The iBGP Reflection Mechanism https://sassenachlearns.com/2017/12/04/bgp-route-reflectors-rr-the-ibgp-reflection-mechanism/ https://sassenachlearns.com/2017/12/04/bgp-route-reflectors-rr-the-ibgp-reflection-mechanism/#respond Mon, 04 Dec 2017 13:31:00 +0000 https://sassenachlearns.com/?p=63 Light when bounces off an object is called “reflection.” Remember the “Law of Reflection” during High School days? The angle of incidence equals to the angle of reflection. Thinking about this might somehow give you a better grasp on the BGP Route Reflectors. As we progress this topic, you will see how routes are reflected.

Remember the split horizon rule in iBGP? Route Reflector (RFC 4456) is one of the three solutions and often use as an alternative to Full Mesh topology. Route Reflectors allows iBGP speaker to have partial mesh topology while still propagating iBGP routes to another iBGP speaker. It modifies the iBGP split horizon rule by allowing the router to forward incoming iBGP updates to an outgoing iBGP session under. With Route Reflector, it lowers CPU and memory requirements by reducing the number of TCP sessions to be maintained.

Route Reflector has two iBGP peers: Client peers and Non-Client peers. Route-Reflector clients behave like normal iBGP routers. They are not required to form full mesh, can have any number of eBGP sessions and they can have only one iBGP session and that is the connection to Route-Reflector. When Route Reflector fails, they can no longer receive or send updates to the rest of the AS. In this kind of design, Route Reflector represents a single point of failure. In order to solve this, we need redundant Route Reflectors. Each Clients needs to connect to redundant Route Reflectors. Route Reflectors receive the same iBGP update from its Clients and reflect it all other Clients and Route Reflectors send same routes to each Clients.

The use of redundancy in Route Reflectors may introduce routing loops in the network. However, no need to worry as Route Reflector has Cluster_List and Originator_ID attributes.

Route Reflector and its Clients formed a cluster. Each cluster must have a unique Cluster ID. The Cluster ID is being prepended to the “Cluster_List” each time the route is being reflected. Cluster_List is an Optional Non-Transitive BGP attribute. Remember the BGP Path selection process? It is the 12th criteria of BGP selection attribute. Like AS Path, the minimum cluster list length is more preferred. Also like AS Path, it shows the path the route has passed. It also serves as a loop avoidance mechanism as it discarded routes with the same local Cluster ID. Take note that Cluster ID is configured in Route Reflector. When a Route Reflector receives a routing update from another Route Reflector in the same cluster, it rejects the update.

There is another loop avoidance mechanism of Route Reflector and that is the Originator_ID. It is another Optional Non-Transitive BGP Attribute and as the name suggests, it identifies the originator of the route. The router ID is added as the Originator_ID to the route when received from eBGP peer and when there is already one exists, a router needs not to add another Originator_ID. When a routing update is received from the same local Originator_ID, then the update is discarded.

All other that are not part of the cluster are non-clients. Non Clients do not support Route Reflector functionalities. Unlike with Clients, Non-Clients need to fully mesh.

Route Reflector Forwarding of Prefixes Rules

Route Reflector propagates eBGP learnt prefixes and iBGP prefixes learnt prefixes from Clients and Non-Clients to Clients. Route reflector propagates eBGP learnt prefixes and iBGP learnt prefixes from Clients to Non-Clients. It will not forward learnt iBGP prefixes from Non-Clients to Non-Clients.

Before we end this discussion, there is one more important thing to remember. A Route Reflector can reflect route only within a single cluster. It can participate in multiple clusters but only as a client. A client can only function as a client only to Route Reflector belonging to the same cluster.

]]>
https://sassenachlearns.com/2017/12/04/bgp-route-reflectors-rr-the-ibgp-reflection-mechanism/feed/ 0
iBGP: BGP Next-Hop-Self Command https://sassenachlearns.com/2017/11/06/ibgp-bgp-next-hop-self-command/ https://sassenachlearns.com/2017/11/06/ibgp-bgp-next-hop-self-command/#respond Mon, 06 Nov 2017 13:55:00 +0000 https://sassenachlearns.com/?p=83 The BGP next hop processing distinguishes iBGP from eBGP. A route advertised from an eBGP to another eBGP peer, the next hop address will be the address of the exit point of that AS. A route advertised from an eBGP to iBGP, the next-hop address remains unchanged when sent to another iBGP peer. It will not insert its own address as the next-hop address of the advertised route. The problem here is, what if that iBGP peer doesn’t know how to reach that eBGP address?

BGP Next-Hop-Self

Let’s take this scenario.

Colletidae, a blellum lady living in the outskirt of Edinburgh, told her neighbor Apidae that Dasypoda is having an illegal affair with somebody else. Colletidae told Apidae that she can spread that in town. And, because Colletidae wants so much attention, she told her to tell everybody that she is the one who told her about it. Colletidae knows that everybody will believe Apidae as she is known to be an honest quine. Apidae cannot believe it and she told Andrena, sister of Andrenidae, about this.

“Don’t be such a wee clipe!”, said Andrena. “Are you the one spreading that rumor?”

“No, it’s not me. It’s Colletidae who told me about that.” Apidae replied.

When Andrena told her sister about this rumor,

“Who told you that?” Andrenidae asked

“Colletidae knows everything about Dasypoda’s affair,” Andrena whispered.

“Who is Colletidae?” Andrenidae asked.

Andrenidae, who is one of Dasypoda’s best friend, knows that it was her sister who told her about the affair rumor. What she didn’t know is that it was Apidae who told her sister about this and that Apidae knows where Colletidae lives.

This is true with partial mesh topology in iBGP. There is no route back to Colletidae.

With the use of next-hop-self command, it would force the iBGP speakers to advertise the route with the next hop address of its own.

Let’s do a simple lab about this scenario.

Let’s see what will happen after Dasypoda advertised its loopback address.

Enter configuration commands, one per line. End with CNTL/Z.
Dasypoda(config)#router bgp 600
Dasypoda(config-router)#network 6.6.6.0 mask 255.255.255.0
Dasypoda(config-router)#end

After Dasypoda advertised its loopback address, Colletidae learned it and install it in its routing table:

BGP Next-Hop-Self

]]>
https://sassenachlearns.com/2017/11/06/ibgp-bgp-next-hop-self-command/feed/ 0
BGP Local Preference Attribute: The Higher The Better https://sassenachlearns.com/2017/11/06/bgp-local-preference-attribute-the-higher-the-better/ https://sassenachlearns.com/2017/11/06/bgp-local-preference-attribute-the-higher-the-better/#respond Mon, 06 Nov 2017 13:47:00 +0000 https://sassenachlearns.com/?p=76 One of the many BGP attributes is the Local Preference. Seventy percent of those who are just new in BGP will ask were to apply Local Preference.

BGP Local Preference

Local Preference is used to influence outbound traffic. The higher value is preferred over the lower one.

Let’s take an example.

Looking at my diagram, to route traffic to Dasypoda, if we have all BGP attribute set as default, what path will Apidae take? Is it going to be Colletidae (10.0.30.3)->Dasypoda (10.0.60.6) or  Andrenidae (10.0.70.4)-> Mellitinae (10.0.40.5) -> Dasypoda (10.0.50.6)? If we didn’t set the Local Preference, it will surely go to Collitidae (10.0.30.3)->Dasypoda (10.0.60.6) path.

BGP Local Preference

Let us check the routing table to know why it prefers the Colletidae (10.0.30.3)->Dasypoda (10.0.60.6) path:

As you can see, the valid best path to 6.6.6.0/24 is through 10.0.30.3.

BGP Local Preference: show ip bgp

The question is why? Since Local Preference is not configured, BGP checks the next path selection attribute which is the AS Path. The shortest is more preferred. However, we do not want the Colletidae (10.0.30.3)->Dasypoda (10.0.60.6) path. We want the packet to take the Andrenidae (10.0.70.4)-> Mellitinae (10.0.40.5) -> Dasypoda (10.0.50.6) path. So how are we going to do it? Let us configure the Local Preference.

Apidae(config)#route-map PRIMARY-PATH permit 10
 Apidae(config-route-map)#set local
 Apidae(config-route-map)#set local-preference ?
 <0-4294967295> Preference value


Apidae(config-route-map)#set local-preference 250
 Apidae(config-route-map)#exit
 Apidae(config)#router bgp 65500
 Apidae(config-router)#neigh 10.0.70.4 route-map PRIMARY-PATH ?
 in Apply map to incoming routes
 out Apply map to outbound routes

Apidae(config-router)#neigh 10.0.70.4 route-map PRIMARY-PATH in
 Apidae(config-router)#end

Now that the LOCAL PREFERENCE is changed to prefer the route to neighbor Andrenidae, the path Andrenidae (10.0.70.4)-> Mellitinae (10.0.40.5) -> Dasypoda (10.0.50.6)  is now considered as the best valid path in the BGP table.

BGP Local Preference: show ip bgp

There is another way of manipulating the Local Preference and it is through bgp default local-preference command. Keep in mind that it is just changing the default value of Local Preference from 100 to the value you entered.

Before we end this discussion, what can you notice about this ping result?

BGP Local Preference

We have configured the Local Preference and it works as it prefers the Andrenidae (10.0.70.4)-> Mellitinae (10.0.40.5) -> Dasypoda (10.0.50.6). But what happened to the return traffic? We will see why on our next topic – BGP Multi-Exit Discriminator (MED).

]]>
https://sassenachlearns.com/2017/11/06/bgp-local-preference-attribute-the-higher-the-better/feed/ 0
BGP Path Attributes: The BGP Path Selection Process https://sassenachlearns.com/2017/11/03/bgp-path-attributes-the-bgp-path-selection-process/ https://sassenachlearns.com/2017/11/03/bgp-path-attributes-the-bgp-path-selection-process/#respond Fri, 03 Nov 2017 13:58:00 +0000 https://sassenachlearns.com/?p=90 BGP Path Attributes

BGP has many attributes in choosing the best path. It is like an ice cream. It has many flavors. I bought Gianduia flavor from Gelato Messina while I was preparing this topic. I think I need loads of sugar to feed my brain as this BGP topic is robust and every attribute can be well-explained if we are going to lab it.

BGP’s attributes are mainly for path manipulation and these can influence either outbound or inbound traffic. It has a systematic process that it uses to choose the best path in the network.

The first thing that BGP checks is whether the WEIGHT is configured or not. WEIGHT is Cisco Proprietary so it is obvious that it prioritizes Cisco devices which has BGP WEIGHT configured. In short, if you are using Cisco devices, WEIGHT is the first thing it checks before it goes on with the series of standard BGP attributes. Keep in mind that WEIGHT is local to the router and doesn’t pass to other routers. The higher the value is more preferred.

Next in line is the LOCAL PREFERENCE. This attribute influences the outbound routing. The higher value is preferred. Unlike WEIGHT, which has a default value of 0, LOCAL PREFERENCE has a default value of 100.

If LOCAL PREFERENCE is not configured, BGP looks for locally originated routes. As the name suggests, it is a route originated by the local router via network statement, redistribution, or aggregate statement. If you do “show ip bgp” routes with weight set to “32768” is considered as local routes. When weight is configured check for routes with next hop of “0.0.0.0.” You can also use “route-map localonly” command to get locally originated routes. It is also local to the router an not pass to other peers.

The most commonly used BGP attribute is the AS PATH. Unlike, LOCAL PREFERENCE, AS Path is a Well-Known Mandatory attribute and this attribute influences inbound routing. It should be present in every update and should be recognized by all BGP speakers. When a router running BGP session sends an update to its peer, it appends its own AS number. The shorter the AS path length is more preferred. To manipulate the incoming traffic to our preferred route, we can use the “as-path prepend” command.

Like, AS PATH, ORIGIN is also a Well-Known Mandatory attribute. In this attribute, the lowest is preferred route. IGP is lower than Exterior Gateway Protocol (EGP), and EGP is lower than INCOMPLETE. If you do “show ip bgp” you will see ORIGIN codes at the far right portion: i – IGP, e – EGP, and ? – incomplete. You will no longer see “e” in the “show ip bgp” output as it is already obsolete. The question mark “?” indicates redistribution and “i” means the network command is used to advertise the route.

Multi-exit Discriminator (MED) is an optional non-transitive BGP attribute. It is usually not used as the first five attributes are often utilized before this one. MED can influence routers in the same AS (iBGP) but not on different AS (eBGP). When a router learns a route from a peer, the MED’s value is kept and retain to its iBGP peers, but the value will be peeled off once it passed to eBGP peers. You can use the “set metric” command under the BGP router process if you are using a route-map or use the “default-metric” command. Take note that the lowest MED value is preferred over the higher MED value.

If MED is not configured, it checks whether the route is learned via iBGP or eBGP. Routes learned via eBGP is more preferred than routes learned via iBGP. If both routes are learned via eBGP then it chooses the lowest IGP value (administrative distance) to the next hop.

BGP Multipath is not considered as a tie-breaker but a determination if it can allow multiple installation of path in the routing table. The WEIGHT, LOCAL PREFERENCE, AS PATH, ORIGIN, MED value, same neighbor type (eBGP / iBGP) and IGP metric should match with the best path for it to be considered as an additional path to the destination. Be aware that if multipath is not enabled the default value is 1 which means it goes back to the BGP’s golden rule that it only chooses one best path to the destination.

The next step that BGP considers is the oldest route received. The oldest route in the routing table is preferred over the new ones. This step can be skipped if router ID is used for tie breaker and that the “bgp bestpath compare-routerid” command is used. If the command is used, the lowest router ID will be selected as the best path. If there is no manually configured router ID, the highest loopback IP is chosen and if still there is none, then the highest configured physical IP address. By the way, before you considered the highest physical IP address, it is necessary to check the route with minimum cluster list length configured. This is present in a route reflector environment. There’s more about this when we get to the route reflector topic.

Before we end this topic, let me remind you that before it goes to these 13 procedures, the first thing that BGP check is whether the next hop is reachable or not. What’s the use of all of these if the route is not reachable anyway?

5 comments on “BGP Path Attributes: The BGP Path Selection Process”

  1. Pingback: BGP Path Attributes Types – Sassenach Learns
  2. Pingback: iBGP: BGP Next-Hop-Self Command – Sassenach Learns
  3. Pingback: BGP Local Preference Attribute: The Higher The Better – Sassenach Learns
  4. Pingback: The Internet Protocol: Border Gateway Protocol (BGP) Overview – Sassenach Learns
  5. Pingback: BGP Route Reflectors (RR) – The iBGP Reflection Mechanism – Sassenach Learns

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website Search

CATEGORIES

RECENT POSTS

]]>
https://sassenachlearns.com/2017/11/03/bgp-path-attributes-the-bgp-path-selection-process/feed/ 0
BGP Path Attributes Types https://sassenachlearns.com/2017/11/01/bgp-path-attributes-types/ https://sassenachlearns.com/2017/11/01/bgp-path-attributes-types/#respond Wed, 01 Nov 2017 18:25:00 +0000 https://sassenachlearns.com/?p=161 BGP has many attributes in choosing the best path. However, not all attributes need to be present in every BGP update and need to be recognized or passed to other peers. There are some that can be silently discarded and ignored.

BGP attributes are classified into 4 types:

  1. Well-known Mandatory
  2. Well-known Discretionary
  3. Optional Transitive
  4. Optional Non-Transitive

Well-known Mandatory attributes, as the name suggests, it is a must in every BGP update to have it included. It should exist in every BGP update and must be recognized by all BGP speakers. Well-known mandatory attributes are AS Path, Next Hop address, and Origin.

Well-known Discretionary must be recognized by all BGP speakers but not necessarily included in every BGP update. It includes Local Preference and Atomic Aggregate.

Optional Transitive and Optional Non-Transitive are attributes that don’t need to be understood and supported by all BGP speakers. The main difference between these two is that if it is set as transitive, it means it has to advertise to all peers and if is set as non-transitive then it can be ignored and not passed to other peers. Optional Transitive attributes are Aggregator and Community. Optional Non-Transitive attributes are Originator ID and Cluster List.

Type Code ValueAttributeAttribute Type
1OriginWell-Known Mandatory
2AS_PathWell-Known Mandatory
3Next_HopWell-Known Mandatory
4Multi-Exit Discriminator (MED) Optional Non-Transitive
5Local_PreferenceWell-Known Discretionary
6Atomic_AggregateWell-Known Discretionary
7AggregatorOptional Transitive
8CommunityOptional Transitive
9Originator_IDOptional Non-Transitive
10Cluster_ListOptional Non-Transitive

BGP path attributes types don’t seem to be of importance for now. However, as we go further our BGP studies, we will realize the essence of it.

]]>
https://sassenachlearns.com/2017/11/01/bgp-path-attributes-types/feed/ 0
The Internet Protocol: Border Gateway Protocol (BGP) Overview https://sassenachlearns.com/2017/10/31/the-internet-protocol-border-gateway-protocol-bgp-overview/ https://sassenachlearns.com/2017/10/31/the-internet-protocol-border-gateway-protocol-bgp-overview/#respond Tue, 31 Oct 2017 22:05:00 +0000 https://sassenachlearns.com/?p=134 Border Gateway Protocol (BGP) is an exterior gateway protocol used on the internet and ISPs to exchange routing and reachability information. BGP is a layer 4 path vector routing protocol that uses port 179. It is the only EGP that is still in use today. The current BGP version is BGPv4 which was published as RFC 4271 in 2006.

Unlike other IGPs (OSPFEIGRP, or RIP), BGP has many metrics or attributes in choosing the best path in the network. These attributes are for path manipulation. We will check it one by one as those attributes influence either inbound or outbound traffic.

BGP is further classified into two: eBGP and iBGP. When peers that run BGP within the same AS, it is called iBGP (Internal Border Gateway Protocol) and peers that run BGP session in different AS, it is called eBGP (External Border Gateway Protocol). The iBGP and eBGP differ on how routes are propagated in other peers. Routes learned from an iBGP peer will never be learned or advertised to another iBGP peer because of a “Split Horizon Rule.” In order for a route to be learned from an iBGP neighbor, it must be first known via IGP. This is called the “Synchronization Rule.” This will be later explained as we progress to Split Horizon Rule solutions.

BGP is the slowest routing protocol but being the slowest makes it a perfect routing protocol on the internet. The 3 minute convergence time is designed that way in order to prevent constant link flap. Now, you might be thinking why do we have to use BGP. Aside from the fact that it is a slow protocol, EIGRP and OSPF can also do the routing of the traffic to the internet. I think the better question here is when to use BGP. It doesn’t make sense if we are going to use BGP if we have only one or a single connection to the ISP. There is only one exit path so a default route can do the job. This is called a single-homed connection. But what if we have a dual multihomed design, which means dual connections (dual links) to two different ISPs, then BGP is far more useful than IGP. BGP attributes can be configured to better manipulate the path to the destination.

BGP RELATED TOPICS:

  1. BGP Path Attributes Types
  2. AS Number Range
  3. BGP Neighbor States
  4. BGP Message Types
  5. BGP Attributes
  6. BGP Next-Hop-Self
  7. BGP Communities
  8. BGP Multipath
  9. BGP Route Reflector

BGP CONFIGURATION / LABS

  1. Basic BGP Configuration
  2. Configuring iBGP and eBGP
  3. BGP Confederation
  4. eBGP Multihop
  5. Redistributing OSPF into BGP
  6. BGP AS Path Attribute
  7. BGP Local Preference
  8. BGP MED
  9. BGP Authentication

]]>
https://sassenachlearns.com/2017/10/31/the-internet-protocol-border-gateway-protocol-bgp-overview/feed/ 0