Analysis of BGP Prepending in the LAC Region in 2024

09/10/2024

Analysis of BGP Prepending in the LAC Region in 2024

By Alejandro Acosta, R&D Coordinator at LACNIC

Introduction

In this report, we will explore a very specific aspect of BGP tables in our region, focusing on the status of BGP prepends. We will provide a detailed review of both IPv4 and IPv6 BGP tables and share our findings. 

Commonly known as ‘AS Path Prepending,’ BGP prepending is a long-established and very popular technique designed as a key strategy for influencing route selection and optimizing an AS’s inbound and outbound traffic. It is used by all types of network operators. But how effective is this technique? Should it always be used? Are there any other options?

History

As we mentioned a few months ago in our blog post titled A Much-Needed BGP RFC: AS Path Prepending [1], a document titled ‘AS Path Prepending’ [2] is currently being developed within the IETF, and LACNIC had the opportunity to participate and contribute to the draft. The document outlines several considerations for configuring BGP prepending. This raises the question: Are we doing things right in Latin America and the Caribbean? This report will hopefully address several concerns.

What is AS Path Prepending?

AS Path Prepending is a technique that involves repetitively adding one’s autonomous system identifier (ASN) to the list of ASs in a BGP route path (AS_PATH). Its goal is to influence route selection by making certain paths less attractive to inbound/outbound traffic. In other words, it consists of adding our autonomous system to the AS_PATH and thus artificially ‘lengthening the path’ to a prefix on the Internet.

In the image above, without prepends, Router A prefers to reach C via B. However, when three prepends are added by B, router A decides to reach C via D.

Data Sources Used for This Study

https://bgp.potaroo.net/v6/as2.0/bgptable.txt (IPv6)

https://bgp.potaroo.net/as2.0/bgptable.txt (IPv4)

Scope

  • We work with prefixes managed by any of the RIRs
  • The AS_PATH must contain at least one AS from the LACNIC service region

Tools to Be Used for This Study

  • Python3
  • JupyterLabs
  • BGP tables in “show ip bgp” format in Cisco IOS

Findings

Total number of prefixes in the routing table

The data below shows the number of prefixes in the DFZ (Default Free Zone) at the time this analysis was performed (snapshot of the routing table taken on 22 August 2024).

IPv6: 214682 (17.99%)

IPv4: 978614 (82.01%) 

Number of AS_PATHs that were analyzed

The data in this section correspond to the total number of AS_PATHs that were counted

IPv6: 822573 = 22.10 %

IPv4: 2900978 = 77.90 %

Prefixes where at least one AS in the AS_PATH is from LACNIC

Number of the AS_PATHs above in which ASs from our region can be observed

IPv6: 47242 (26.27 %)

IPv4: 132559 (73.73 %)


Number of prefixes with prepends in LAC

Data in this section shows the total number of prefixes by IP address family where ASNs are obtained by prepending in our region. 

IPv6: 16822 (32.36%)

IPv4: 35154 (67.64%)

Number of origin ASs performing prepending, based on the AS_PATH.

The following data reflects the number of origin autonomous systems that perform BGP prepending. In this case, the AS_Origin does not necessarily correspond to LACNIC. As long as there is a LACNIC ASN in the AS_PATH, it is included in the count.

IPv6: 34832 (48.58 %)

IPv4: 36863 (51.42%)

Single-homed ASs performing prepending

Keeping in mind that prepending in single-homed ASNs is not considered a best practice (section 5 of the IETF draft), the following results were obtained for ASNs in the LACNIC service region.

IPv6: 296 (28.21%)

IPv4: 753 (71.79%)

More than 5 prepends in the AS_PATH

In line with the best practice described in section 5 of the IETF draft, there is no need to prepend more than 5 ASs. Thus, we focused on those that exceed this number, as more than 80% of destinations fall within this AS_PATH length.

IPv6: 4177 (51.69%)

IPv4: 3903 (48.31%)

Prefix with the most prepends

The following information corresponds to the maximum prepend length in IPv6 and IPv4.

IPv6: 27 prepends (August 2024)

IPv4: 61 prepends (August 2024)

Where do the prepends occur?

The graphs below show the typical location of prepends in the AS_PATH.

16-bit vs 32-bit prepends 

The data represents a simple count of repeated ASNs in AS_PATHs, by bit length. ASNs above 65,535 represent 32-bit ASNs.

16 bits32 bits
IPv615360328445
IPv411582468970

Top 10 ranking of repetitions

This data ranks the top 10 countries based on the number of times ASNs from those countries performed BGP prepending in the AS_PATH. 

For clarity, this is the algorithm we used:

FOR AS_PATH in AS_PATHs_CON_PREPENDS:

FOR ASN in AS_PATH:

ccASN = pais(ASN)

Dict_ASNs_CC[ccASN] = Dict_ASNs_CC[ccASN] + 1
IPv6  IPv4 
CCRepetitions CCRepetitions
 MX106710  BR76110
 BR35460  AR29804
 CO30549  CO26892
 AR3074  MX10239
 PA1876  CR5811
 EC943  PA5172
 PE859  CL4697
 DO408  EC4038
 CL281  VE3605
 NI272  PE2956

Top 5 countries performing BGP prepending in our region (ratio)

To calculate the ratio of countries that perform the most prepends, we first counted the occurrence of each country in each AS_PATH, and then applied the same methodology exclusively to those that included prepends. Finally, the total was divided by the number with prepends. 

For example, for Cuba, 12 entries were found in the BGP table (IPv6), with 6 entries having prepends. In this case, the ratio is 2 (12/6).

For Curacao, 108 entries were found in the BGP table (IPv6), 9 of them having prepends, so the ratio is 12 (108/9).

This means that in Cuba, for every 2 AS_PATHs in the global BGP table, 1 includes prepends. Similarly, in Curacao, for every 12 AS_PATHs in the global BGP table, 1 contains prepends.

Top 5 countries with the lowest ratios (performing more prepends):

IPv6IPv4
CCRatio CCRatio
MX1.75 BZ2.6
CU2 AW3.04
BO3.4 PY3.07
BZ3.2 AR3.3
SV6 PA3.53

TOP 5 countries with the highest ratios (performing less prepends):

IPv6IPv4
CCRatio CCRatio
SR60 CW45.11
GY53 CU 37.5
CR36.61 SV14.96
GT28.7 UY11.98
CL26.15 MX11.13

Conclusions

BGP prepending is a technique commonly used in our region, but it is crucial to disseminate best implementation practices and explore alternative traffic engineering options. Our recent analysis reveals that 296 single-homed organizations are using prepending on IPv6 and 753 on IPv4, a number that raises concern. Moreover, it is alarming that many operators exceed five prepends, with some extreme cases performing up to 27 prepends on IPv6 and 61 on IPv4. Such practices not only don’t have a positive impact on routing tables, but negatively affect memory, CPU, and the networks on BGP Speakers.

An aspect worth noting is the imbalance in the use of prepends between IPv4 and IPv6, which leads us to ask ourselves: What is causing this difference? This analysis seeks to raise awareness about the proper implementation of BGP prepending.

We encourage you to review how you publish your prefixes and ensure responsible implementation!

Do you have any comments? We’d love to hear from you!

I invite you to watch the video of my presentation during the LACNIC 42 LACNOG 2024 event.

References

[1] https://blog.lacnic.net/un-necesario-rfc-sobre-bgp-as-path-prepending/

[2] https://datatracker.ietf.org/doc/html/draft-ietf-grow-as-path-prepending-12 

Subscribe
Notify of

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments