Skip to content
Cloudflare Docs

Configure routes

Magic Networking uses a routing table to steer your traffic from Cloudflare's global network to your connected networks via next-hop. You can add entries to the Magic routing table through static route configuration or routes learned from BGP peering (only available over Direct CNI).

Refer to Traffic Steering for more information about all the technical aspects related to:

  • Routes' priorities and weights
  • Regional scoping of traffic to reduce latency
  • BGP peering

Configure static routes

Create a static route

  1. Go to Magic Transit's Configuration page.
Go to Configuration
  1. From the Routes tab, select Create to add a new route.
  1. Enter a descriptive name for your route in Description.
  2. In Prefix, enter your range of IP addresses. For example, 10.10.10.100/24.
  3. In Tunnel/Next hop, select a tunnel for your route from the tunnels you created in Configure tunnel endpoints.
  4. Choose the Priority for your route. Lower numbers have higher priorities.
  5. (Optional) Choose a Weight for your route. Refer to Set priority and weights for static routes for examples.
  6. (Optional) If you need to scope your route to a specific region, you can do it in Region code.
  7. (Optional) We highly recommend testing your route before adding it by selecting Test routes.
  8. Select Add routes.

Edit a static route

  1. In Routes, locate the route to modify.
  2. Select the three dots next to it > Edit.
  1. Enter the updated route information.
  2. (Optional) We highly recommend testing your route before adding it by selecting Test routes.
  3. Select Edit routes.

Delete static route

  1. In Routes, locate the static route to delete.
  2. Select the three dots next to it > Delete.
  1. Confirm the action by selecting the checkbox and select Delete.

Configure BGP routes

BGP peering is available when using a Direct CNI as an on-ramp.

Choose an ASN for BGP peering

The Magic routing table is managed by the customer. You can select both the Cloudflare-side ASN (Autonomous System Number) and the ASN for your customer device. The customer device ASN can be 2-byte or 4-byte. Public ASNs used for Magic Transit are verified during the onboarding process.

By default, each BGP peering session uses the same Cloudflare-side ASN to represent peering with the Magic Transit routing table. This ASN is called the CF Account ASN and is set to 13335. You can configure this to a private 2-byte ASN (for example, any value between 64512 and 65534).

To set this ASN:

  1. Go to Magic Transit's Configuration page.
Go to Configuration
  1. Go to BGP configuration.
  2. In CF Account ASN, enter Cloudflare's ASN.
  3. Select Update.

Magic Transit customers should also be aware of the following:

  • The Cloudflare side ASN will never be exposed in AS_PATH of anycast announcements from the Cloudflare edge. In those announcements, Cloudflare will always use the Cloudflare ASN of 13335 optionally prepended with a bring-your-own ASN as described in Cloudflare ASN vs. your own ASN.
  • The customer device ASN can be a private ASN or the ASN they are using for Magic Transit anycast announcements at the edge: this has no impact on the ASN for the anycast announced prefix at the edge of the Cloudflare global network.

Set up BGP peering

You need to configure two ASNs:

  • The Cloudflare account-scoped ASN named CF Account ASN.
  • One ASN for each interconnect you want to configure with BGP.

If you have already set up your Cloudflare account ASN, skip steps two and three below.

  1. In the Cloudflare dashboard, go to Magic Transit's Configuration page.
Go to Configuration
  1. Go to BGP configuration.
  2. In CF Account ASN, enter Cloudflare's ASN.
  3. Go to Interconnects.
  1. Locate the Direct CNI interconnect to configure with BGP > select the three dots next to it > Configure BGP.

  2. In Customer device ASN, enter the ASN for your network.

  3. In MD5 key, you can optionally enter the key for your network. Note that this is meant to prevent accidental misconfigurations, and is not a security mechanism.

  4. (Optional) In Advertised prefix list, input the additional prefixes automatically assigned by Cloudflare during the creation of the CNI interconnect. These prefixes advertise alongside your existing routes. Leave this blank if you do not want to advertise extra routes.
    Typical prefixes to configure here include:

    • A route to 0.0.0.0/0, the default route — to attract all Internet-bound traffic if using Magic Transit with Egress.
    • A route to 100.96.0.0/12, the portion of CGNAT space used by default with WARP clients.
  5. Select Save.