Skip to content
Cloudflare Docs

Configure routes

Magic Networking uses a routing table to steer your traffic via next-hop from Cloudflare's global network to your connected networks. Entries can be added to the Magic routing table via static route configuration or via routes learned through 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. Log in to the Cloudflare dashboard, and select your account.
  2. Go to Magic WAN > Configuration.
  3. From the Routes tab, select Create to add a new route.
  4. Enter a descriptive name for your route in Description.
  5. In Prefix, enter your range of IP addresses. For example, 10.10.10.100/24.
  6. In Tunnel/Next hop select which tunnel you want your route to go through. Choose from the tunnels you have created in Configure tunnel endpoints.
  7. Choose the Priority for your route. Lower numbers have higher priorities.
  8. (Optional) Choose a Weight for your route. Refer to Set priority and weights for static routes for examples.
  9. (Optional) If you need to scope your route to a specific region, you can do it in Region code.
  10. (Optional) We highly recommend testing your route before adding it by selecting Test routes.
  11. Select Add routes when you are done.

Edit a static route

  1. In Routes, select Edit next to the route you want to modify.
  2. Enter the updated route information.
  3. (Optional) We highly recommend testing your route before adding it by selecting Test routes.
  4. Select Edit routes to save the new information when you are done.

Delete static route

  1. In Routes, locate the static route you want to modify and select Delete.
  2. 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, who can select both the Cloudflare-side ASN and the ASN for their customer device. The customer device ASN can be 2-byte or 4-byte.

By default, each BGP peering session will use the same Cloudflare-side ASN to represent peering with the Magic WAN routing table. This ASN is called the CF Account ASN and is set to 13335. This can be configured to a private 2-byte ASN (for example, any values between 64512 and 65534). To set this ASN:

  1. Log in to the Cloudflare dashboard, and select your account.
  2. Go to Magic WAN > Configuration > BGP.
  3. In CF Account ASN, enter Cloudflare's ASN.
  4. Select Update.

Magic WAN customers should also be aware of the following:

  • The Cloudflare side ASN will be included in the AS_PATH of announced routes to any BGP enabled interconnect.
  • The customer chooses their device ASN, which should be different to the Cloudflare-side ASN.

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 already have set up your Cloudflare account ASN, you can skip steps two and three below.

  1. Log in to the Cloudflare dashboard, and select your account.
  2. Go to Magic WAN > Configuration > BGP.
  3. In CF Account ASN, enter Cloudflare's ASN.
  4. Go to Interconnects.
  5. Find the Direct CNI interconnect you want to configure with BGP > select the three dots next to it > Configure BGP.
  6. In Customer device ASN, enter the ASN for your network.
  7. 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.
  8. (Optional) In Advertised prefix list, input the additional prefixes automatically assigned by Cloudflare during the creation of the CNI interconnect, to advertise alongside your existing routes. Leave 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 WAN with Gateway.
    • A route to 100.96.0.0/12, the portion of CGNAT space used by default with WARP clients.
  9. Select Enable BGP.

Next steps

Now that you have configured your tunnels and routes, the next step is to create a site.

Sites represent the local network of a data center, office, or other physical location, and combine all on-ramps available there. Sites also allow you to check, at a glance, the state of your on-ramps and set up health alert settings so that you get notified when there are issues with the site's on-ramps.

Refer to Set up a site for more information.