Skip to content

Commit 76e0ddb

Browse files
[MT] Advertise prefixes (#23660)
* added content * added content * added content * added content * added content * imported components * refined text * refined text * refined text * refined text * refined title * added info on BGP RR * removed BGP peering cni * refined text * refined text * added render to regions * created regions partial * refined text * refined text * imported render * corrected yml * Apply suggestions from code review Co-authored-by: Kate Tungusova <[email protected]> --------- Co-authored-by: Kate Tungusova <[email protected]>
1 parent 8fd6c16 commit 76e0ddb

File tree

3 files changed

+135
-56
lines changed

3 files changed

+135
-56
lines changed

src/content/docs/magic-transit/how-to/advertise-prefixes.mdx

Lines changed: 117 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,75 +5,148 @@ sidebar:
55
order: 5
66
---
77

8-
import { Details, GlossaryTooltip } from "~/components"
8+
import { APIRequest, Details, GlossaryTooltip, Render, Tabs, TabItem } from "~/components"
99

10-
Cloudflare measures the Magic Transit prefix count based on the number of <GlossaryTooltip term="prefix">prefixes</GlossaryTooltip> a customer onboards. The size of each prefix does not matter — there are no commercial or technical restrictions based on prefix length. However, prefixes must be announced exactly as they were provisioned. For example, if a customer onboards a `/20` prefix to Magic Transit, it can only be announced as a `/20`. Smaller sub-prefixes (such as `/24s`) within that `/20` cannot be announced individually unless they are onboarded separately. Onboarding a larger aggregate prefix does not automatically include its smaller subnets for announcement or billing purposes.
10+
## Onboard prefixes
1111

12-
If a customer wants to announce 16 individual `/24` prefixes that fall within a `/20`, they must onboard all 16 `/24s` as distinct prefixes, in addition to the `/20` if desired. In such a disaggregated setup, the total Magic Transit prefix count increases, as each onboarded prefix — including any sub-prefixes — is treated as a separate billable unit.
12+
You can bring your own public IPs to Cloudflare to use with Magic Transit. This process requires two steps:
1313

14-
Provide all IP prefixes you plan to onboard, along with the [Autonomous System Numbers (ASNs)](https://www.cloudflare.com/learning/network-layer/what-is-an-autonomous-system/) from which they will be advertised. When specifying prefixes, observe these guidelines:
14+
1. Add IP <GlossaryTooltip term="prefix">prefixes</GlossaryTooltip> for each IP address block that you bring to Cloudflare. The IP prefix includes the permission (<GlossaryTooltip term="letter of agency">Letter of Agency or LOA</GlossaryTooltip>) that allows Cloudflare to announce the network or its subnets. The IP prefix is also where you define your optional [Autonomous System Number (ASN)](https://www.cloudflare.com/learning/network-layer/what-is-an-autonomous-system/) to be included in Cloudflare's advertised AS path.
15+
2. Define additional BGP prefixes, which control the announcement of the prefix from Cloudflare. By default there is always one BGP prefix that is identical to the IP prefix. You can optionally configure additional, more-specific BGP prefixes (subnets of the IP prefix), up to a maximum prefix length of `/24`.
16+
17+
### IP prefixes
18+
19+
Cloudflare measures the Magic Transit prefix count based on the number of BGP prefixes a customer defines. Each prefix is billed separately, even if they overlap. For example, both a `/16` and any `/24` within it are counted individually. Onboarding a larger aggregate prefix does not automatically include its smaller subnets for announcement or billing purposes.
20+
21+
While there is no billing limit on the accepted prefix sizes, technically only prefixes up to `/24` are accepted for onboarding, as longer ones (like `/25`, `/26`) are not globally routable.
22+
23+
Provide all IP prefixes you plan to onboard, along with the ASNs from which they will be advertised. When specifying prefixes, observe these guidelines:
1524

1625
- Prefixes must support at least 256 hosts (`/24` in classless inter-domain [routing](https://www.cloudflare.com/learning/network-layer/what-is-routing/) CIDR notation). Refer to [Use a Cloudflare IP](/magic-transit/cloudflare-ips/) if you do not meet the `/24` prefix length requirement.
17-
- Internet Routing Registry entries and <GlossaryTooltip term="letter of agency">Letters of Agency (LOA)</GlossaryTooltip> must match the prefixes and originating prefixes you submit to Cloudflare.
26+
- Internet Routing Registry entries and Letters of Agency (LOA) must match the prefixes and originating prefixes you submit to Cloudflare.
1827
- When using contiguous prefixes, specify aggregate prefixes where possible.
1928
- When using Route Origin Authorizations (ROAs) to sign routes for [resource public key infrastructure (RPKI)](https://tools.ietf.org/html/rfc8210), the prefix and originating ASN must match the onboarding submission.
2029
- If you do not own an ASN, you can use the Cloudflare Customer ASN (AS13335).
21-
- Prefixes using BGP-controlled advertisements cannot be used in conjunction with dynamic advertisement (via dashboard/API). Please specify your preferred on-demand advertisement method during the prefix onboarding.
22-
23-
<Details header="Prefix configuration example">
2430

25-
| Prefix | Originating AS |
26-
| ----------------- | -------------- |
27-
| `103.21.244.0/23` | AS13335 |
28-
| `131.0.72.0/22` | AS395747 |
29-
| `103.21.245.0/24` | AS395747 |
31+
#### Choose between Cloudflare’s ASN and your ASN
3032

31-
</Details>
32-
33-
## Cloudflare ASN vs. your own ASN
34-
35-
As a part of your onboarding process, you need to decide the ASN Cloudflare will use to announce your prefixes. If you supply your own ASN, Cloudflare prepends the main Cloudflare ASN (AS13335) to the BGP `AS_PATH`. For example, if your ASN is `AS64496`, anyone directly peering with Cloudflare sees the path as `13335 64496`.
33+
As a part of your IP prefix onboarding process, you need to decide the ASN Cloudflare will use to announce your prefixes. If you supply your own ASN, Cloudflare prepends the main Cloudflare ASN (AS13335) to the BGP `AS_PATH`. For example, if your ASN is `AS64496`, anyone directly peering with Cloudflare sees the path as `13335 64496`.
3634

3735
If you do not have an ASN or do not want to bring your ASN to Cloudflare, you can use the Cloudflare Customer ASN (AS13335).
3836

3937
:::note
4038
For all future onboardings, you must use AS13335. Current customers who are already using Cloudflare's AS209242 do not need to make any changes and can continue using that ASN.
4139
:::
4240

43-
## Advertise or withdraw a prefix
41+
### BGP prefixes
4442

45-
:::note
46-
You can only advertise your prefix [after running pre-flight checks](/magic-transit/get-started/#5-run-pre-flight-checks) with Cloudflare. If your prefix status is greyed out and shows an _Withdrawn_ status, your prefix is locked. Contact your account team to close the pre-flight checks phase with you and unlock your prefixes.
43+
BGP prefixes represent the prefix that will be announced through anycast from Cloudflare's global network. By default, there is always at least one BGP prefix that is identical to the onboarded IP prefix.
44+
45+
For example, if a customer onboards a `/20` IP prefix to Magic Transit, it can only be announced as a `/20` because there is only the default `/20` BGP prefix. Smaller sub-prefixes (such as `/24s`) within that `/20` cannot be announced individually unless they are configured as separate BGP prefixes.
46+
47+
Note that for billing purposes, Cloudflare measures the Magic Transit prefix count based on the number of BGP prefixes a customer defines.
48+
49+
### BGP prefix advertisement control methods
50+
51+
Cloudflare offers multiple mechanisms for customers to control the announcement and withdrawal of on-demand prefixes. Customers can choose to manage advertisements through one of the following methods:
52+
53+
- The [Addressing API](/api/resources/addressing/subresources/prefixes/subresources/bgp_prefixes/methods/edit/).
54+
- BGP peering with Cloudflare's route reflectors: Either over the Internet or over a Classic CNI connection. Contact your Cloudflare account team if you need this option.
55+
- [Magic Network Monitoring](/magic-network-monitoring/): Dynamically announces prefixes based on user-defined traffic thresholds observed in your network.
56+
57+
:::caution[Important]
58+
You should only use one control method per prefix at any given time. Mixing multiple control planes can lead to conflicting advertisement states, causing unpredictable routing behavior.
4759
:::
4860

49-
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account.
50-
2. Go to **Magic Transit** > **Configuration**.
51-
3. From **IP Prefixes** tab, select the prefix you want to modify > **Edit**.
52-
4. From the dropdown menu **Status**, choose weather the status of your IP is _Advertised_ or _Withdrawn_.
53-
5. _(Optional)_ Edit the description for your prefix.
54-
6. Select **Edit IP Prefix** to save your changes.
61+
## Manage BGP prefixes
62+
63+
### Add a BGP prefix
64+
65+
Create a [POST request](/api/resources/addressing/subresources/prefixes/subresources/bgp_prefixes/methods/create/) to add a BGP prefix. For example:
66+
67+
<APIRequest
68+
path="/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes"
69+
method="POST"
70+
json={{
71+
"cidr": "192.0.2.0/24"
72+
}}
73+
/>
74+
75+
### Advertise or withdraw a BGP prefix
5576

56-
## Edit the status of a prefix
77+
<Tabs syncKey="dashPlusAPI">
5778

58-
1. Go to **Magic Transit** > **Configuration**.
59-
2. From the **IP Prefixes** tab, locate the prefix you want to modify.
60-
3. Select the three dots in front of the IP prefix > **Delete**.
61-
4. Confirm your choice from the modal by selecting **Delete**.
79+
<TabItem label="Dashboard">
80+
:::note
81+
You can only advertise your prefix after running pre-flight checks with Cloudflare. If your prefix status is greyed out and shows a Withdrawn status, your prefix is locked. Contact your account team to close the pre-flight checks phase and unlock your prefixes.
6282

63-
To avoid latency and potentially dropped routes, enable prefix advertisement from Cloudflare before withdrawing the advertisement from your data center.
83+
Currently, only the default BGP prefix (that matches the IP prefix) can be controlled via the Cloudflare dashboard.
84+
:::
6485

65-
You should also be aware that announcing or withdrawing a prefix should propagate across Cloudflare's global network almost instantly, with changes typically taking effect within a few minutes at most. However, Cloudflare has no control over how long ISPs take to refresh their routes. Keep this in mind when announcing or withdrawing a prefix from your account, and plan accordingly.
86+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account.
87+
2. Go to **Magic Transit** > **Configuration**.
88+
3. From the **IP Prefixes** tab, select the prefix you want to modify > **Edit**.
89+
4. From the dropdown menu **Status**, choose whether the status of your IP is **Advertised** or **Withdrawn**.
90+
5. (Optional) Edit the description for your prefix.
91+
6. Select **Edit IP Prefix** to save your changes.
92+
</TabItem>
6693

67-
## Delete a prefix
94+
<TabItem label="API">
95+
Any configured BGP prefix can be controlled via the API using a [PATCH request](/api/resources/addressing/subresources/prefixes/subresources/bgp_prefixes/methods/edit/). For example:
96+
97+
<APIRequest
98+
path="/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}"
99+
method="PATCH"
100+
json={{
101+
"on_demand":{ "advertised": "true" }
102+
}}
103+
/>
104+
</TabItem>
105+
106+
</Tabs>
107+
108+
:::caution[Warning: ISP route refresh delays may impact traffic]
109+
Announcing or withdrawing a prefix means Cloudflare will begin or stop advertising routes, impacting traffic flow to or from that IP range. Changes propagate across our global network almost instantly, typically taking effect within minutes. However, Cloudflare has no control over how quickly ISPs refresh their routes.
110+
:::
111+
112+
### Delete an IP prefix
68113

69114
You can only delete a prefix with an **Unapproved** status. To delete prefixes with a different status, contact your administrator or account manager.
70115

71116
1. From the **IP Prefixes** tab, locate the prefix you want to modify and select **Delete**.
72117
2. Confirm your choice from the modal by selecting **Delete**.
73118

74-
## Border Gateway Protocol (BGP) control for advertisements (optional)
119+
### Use the API to set AS prepends on a BGP prefix
120+
121+
Use the [Addressing API](/api/resources/addressing/subresources/prefixes/subresources/bgp_prefixes/methods/edit/) to control the number of times Cloudflare prepends its Autonomous System Number (ASN) to a prefix. You can prepend AS13335 up to three times in the `AS_PATH` of BGP updates for your prefixes. For example:
122+
123+
<APIRequest
124+
path="/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}"
125+
method="PATCH"
126+
json={{
127+
"asn_prepend_count": 3
128+
}}
129+
/>
130+
131+
AS prepending helps you gracefully transition traffic between network providers. By adding prepends to Cloudflare's advertisement, you make the route through Cloudflare less preferred for some Internet network providers. This allows you to simultaneously advertise the same prefix from an alternate provider with a shorter, more desirable `AS_PATH`. Advertising from both providers at once can provide a smoother traffic migration and minimize packet loss during a change of provider.
132+
133+
The `"asn_prepend_count"` parameter accepts values from `0` to `3`. A higher value makes the route less preferred.
134+
135+
When you use AS prepending to migrate traffic away from Magic Transit, the typical sequence of events is as follows:
136+
137+
- **Initial state**: Cloudflare advertises your prefix with the default priority (`"asn_prepend_count": 0`). All traffic is routed to your network through the Cloudflare global network.
138+
- **Deprioritize Cloudflare**: You update the prefix via the API to set an AS prepend count (for example, `"asn_prepend_count": 3`). Cloudflare now advertises your prefix with a longer `AS_PATH`. External networks will update their BGP tables to recognize the Cloudflare path has the new, longer `AS_PATH`.
139+
- **Introduce new provider**: You begin advertising the same prefix from your alternate provider with a standard (shorter) `AS_PATH`.
140+
- **Final state**: External networks now receive two advertisements: the prepended route through Cloudflare and the non-prepended route through your new provider. The external network will select a path based on its BGP policy rules.
141+
142+
:::caution
143+
BGP has different mechanisms to control route priorities which are set by the peered network, not by Cloudflare. As such, this is a best effort feature. Cloudflare cannot guarantee that peers will honor AS prepends on Cloudflare's transit and peering connections.
144+
:::
145+
146+
## BGP control with Cloudflare Route Reflectors
147+
148+
Optionally, you can use BGP to control the advertisement status of your prefix — advertised or withdrawn — from Cloudflare's global network for on-demand deployment scenarios. BGP Control works by establishing BGP sessions to Cloudflare's globally distributed Route Reflectors, which will initiate propagation of your prefix advertisement across Cloudflare's global network. You can peer with Cloudflare's Route Reflectors via Internet or CNI. CNI peering is available through your account team.
75149

76-
Optionally, you can use BGP to control the advertisement status of your prefix — advertised or withdrawn — from Cloudflare's global network for on-demand deployment scenarios. BGP Control works by establishing BGP sessions to Cloudflare's globally distributed Route Reflectors, which will initiate propagation of your prefix advertisement across Cloudflare's global network.
77150

78151
Prefixes can be advertised from Cloudflare's network in a supported on-demand method such as BGP Control, or dynamically via the UI, API, or [Magic Network Monitoring](/magic-transit/magic-network-monitoring/). During the onboarding of your on-demand prefixes, please specify whether you want BGP-controlled advertisement or dynamic advertisement (via dashboard/API/Magic Network Monitoring).
79152

@@ -89,16 +162,17 @@ After receiving your information, Cloudflare will update firewall filters to est
89162
When you withdraw a prefix using BGP, you must ensure the prefix is withdrawn across all BGP sessions on all route reflectors. Otherwise, your prefix will not be withdrawn from Cloudflare's global network.
90163
:::
91164

92-
### BGP peering
165+
### Regional settings
93166

94-
If you use Direct CNI as a way to on-ramp your network traffic to Magic Transit, refer to [BGP information](/magic-transit/reference/traffic-steering/#bgp-information) to learn how to use BGP to handle traffic routing between Cloudflare and your network. Note that this is a different option to using BGP as a means to control the advertisement status of your prefix.
167+
Magic Transit requires static routing to steer traffic from Cloudflare's network over one of your configured tunnel off-ramps (for GRE and IPsec tunnels). For CNI, both static routing and BGP options are available. Currently, advertisement of routes for traffic engineering purposes is not supported. As a best practice to reduce last-hop latency, you should consider scoping your routes regionally.
95168

169+
<Render file="traffic-steering-region-codes" product="networking-services/reference" />
96170

97-
### Regional settings
171+
The default setting for static route regions is **All Regions**. Configure scoping for your traffic in the **Region code** section when [adding](/magic-transit/how-to/configure-routes/#create-a-static-route) or [editing](/magic-transit/how-to/configure-routes/#edit-a-static-route) a static route.
98172

99-
Magic Transit requires static routing to steer traffic from Cloudflare's network over one of your configured tunnel off-ramps (for GRE and IPsec tunnels). For CNI, both static routing and BGP options are available. Currently, advertisement of routes for traffic engineering purposes is not supported. As a best practice to reduce last-hop latency, you should consider scoping your routes regionally. The default setting for static route regions is **All Regions**. Refer to [Scoping routes to specific regions](/magic-transit/reference/traffic-steering/#scoping-routes-to-specific-regions) for more information.
173+
Refer to [Scoping routes to specific regions](/magic-transit/reference/traffic-steering/#scoping-routes-to-specific-regions) for more information.
100174

101-
## Example router configurations
175+
### Example router configurations
102176

103177
Below you can find example peering configurations for [Cisco IOS](https://www.cisco.com/c/en/us/td/docs/ios/fundamentals/command/reference/cf_book.html) and [Juniper Junos OS](https://www.juniper.net/documentation/us/en/software/junos/cli/index.html) for on-demand deployments leveraging BGP Control. The IP addresses used are from Cloudflare's route reflectors and should be left as is.
104178

@@ -177,4 +251,4 @@ neighbor 173.245.63.66 {
177251
neighbor 141.101.67.22 {
178252
description "CF RR#3 CDG";
179253
}
180-
```
254+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
{}
3+
---
4+
5+
Cloudflare has nine geographic regions across the world which are listed below.
6+
7+
| Region code | Region |
8+
| ----- | ----- |
9+
| `AFR` | Africa |
10+
| `APAC` | Asia Pacific |
11+
| `EEUR` | Eastern Europe |
12+
| `ENAM` | Eastern North America |
13+
| `ME` | Middle East |
14+
| `OC` | Oceania |
15+
| `SAM` | South America |
16+
| `WEUR` | Western Europe |
17+
| `WNAM` | Western North America |

src/content/partials/networking-services/reference/traffic-steering.mdx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,7 @@ When there are multiple routes to the same prefix with equal priority, and those
162162

163163
### Region codes and associated regions
164164

165-
Cloudflare has nine geographic regions across the world which are listed below.
166-
167-
| Region code | Region |
168-
| ----- | ----- |
169-
| `AFR` | Africa |
170-
| `APAC` | Asia Pacific |
171-
| `EEUR` | Eastern Europe |
172-
| `ENAM` | Eastern North America |
173-
| `ME` | Middle East |
174-
| `OC` | Oceania |
175-
| `SAM` | South America |
176-
| `WEUR` | Western Europe |
177-
| `WNAM` | Western North America |
165+
<Render file="traffic-steering-region-codes" product="networking-services/reference" />
178166

179167
Configure scoping for your traffic in the **Region code** section when adding or editing a static route. Refer to <a href={props.createStaticRoute}>Create a static route</a> and <a href={props.editStaticRoute}>Edit a static route</a> more information.
180168

0 commit comments

Comments
 (0)