Free tech learning for everyone, from basics to pro

Routing & SwitchingNetworking SecurityAdvanced

BGP in the data centre: eBGP underlay for spine and leaf fabrics (RFC 7938)

In short: In a spine and leaf fabric every leaf connects to every spine. Many operators run eBGP on every link, following RFC 7938: spines share one AS, each leaf has its own private AS, and BGP multipath spreads traffic across all spines. The result is simple, scales well and fails cleanly, and it also carries EVPN routes for VXLAN overlays.

Why BGP and not OSPF?

Inside a campus, OSPF or IS-IS is the normal choice. Large data centres, starting with the big cloud operators, found that BGP suited their fabrics better. BGP only sends changes to direct neighbours, it is easy to filter and tag, it scales to hundreds of thousands of routes, and one protocol can carry everything from server subnets to EVPN overlay routes. RFC 7938, "Use of BGP for Routing in Large-Scale Data Centers", describes the design that many vendors now offer as a template.

A spine and leaf fabric using eBGPSpinesone AS shared by all spinesLeaveseach leaf its own ASServersconnected to two leavesECMPmany equal paths through the spines
Figure 1. Every leaf connects to every spine. eBGP on each link gives simple, fast, loop-free routing with many equal paths.

The design rules

  • Clos topology: every leaf has a link to every spine; leaves never connect to leaves, and spines never connect to spines. Any server is at most leaf, spine, leaf away from any other.
  • AS numbering: all spines share one AS, and each leaf (or each pair of leaves) gets its own private AS from the 64512-65534 range or the 4-byte private range. Because a route crossing the fabric would see the spine AS twice if it went back up, BGP's normal AS path check prevents loops automatically.
  • Point-to-point eBGP sessions on every leaf-spine link, with BFD or very short timers.
  • ECMP: a leaf learns each remote prefix from every spine with equal AS path length, and installs all of them.

Example leaf configuration (NX-OS style)

router bgp 65101
  router-id 10.0.0.11
  bestpath as-path multipath-relax
  address-family ipv4 unicast
    network 10.11.0.0/24
    maximum-paths 8
  neighbor 10.1.1.0
    remote-as 65000
    description SPINE-1
    address-family ipv4 unicast
  neighbor 10.1.2.0
    remote-as 65000
    description SPINE-2
    address-family ipv4 unicast

maximum-paths installs several equal paths. multipath-relax allows paths with different AS numbers but the same length to be treated as equal, which matters when leaf pairs use different AS numbers.

BGP unnumbered

Configuring addresses on hundreds of point-to-point links is tedious. Many platforms (Cumulus/NVIDIA, SONiC, Arista, Cisco NX-OS with some features) support BGP unnumbered: sessions form over IPv6 link-local addresses discovered with Router Advertisements, and IPv4 routes are carried with IPv6 next hops (RFC 8950). You only configure the interface name.

Underlay and overlay

This eBGP fabric is the underlay: it only needs to carry leaf loopbacks so VXLAN tunnel endpoints can reach each other. The same BGP sessions, with the EVPN address family enabled, then carry the overlay routes: MAC addresses, host IP addresses and tenant prefixes. This combination, BGP EVPN with VXLAN, is the standard way to build multi-tenant data centre networks today.

Real-world example: an upgrade without an outage window

A hosting provider needed to replace a spine switch during business hours. On the old Layer 2 design with spanning tree, this meant an outage window. On the eBGP fabric they first set graceful-shutdown on the spine (or applied a route map with a long AS path prepend), so every leaf moved traffic to the other spines within seconds. They then powered it off, replaced it and brought it back with no customer impact.

Practice

In an RFC 7938 design, which AS numbers do spines and leaves use?
All spines share one AS, and each leaf (or leaf pair) has its own private AS.
What does bestpath as-path multipath-relax allow?
It lets BGP treat paths with the same AS path length but different AS numbers as equal for multipath.
In a BGP EVPN VXLAN design, what is the underlay used for?
Carrying reachability between leaf loopbacks (the VXLAN tunnel endpoints).

Key takeaways

  • Large data centres often use eBGP as the only routing protocol.
  • Spines share an AS, each leaf has its own, and loops are prevented by AS path checks.
  • maximum-paths and multipath-relax give ECMP across all spines.
  • The same BGP sessions can carry EVPN overlay routes for VXLAN.
Tracks your learning on this device only. See your progress on the learning paths.
Verified author✓ Valid
Issued to
Mohamed Fayas
Role
Founder of FM TecHub
Credentials
CCNABTEC HND Network EngineeringBEng (Hons) Computer Networking & Cloud Security
Issuer
FM TecHub · fmtechub.com

He writes practical, plain-English guides on networking, security and cloud.

More about the author →

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Email updates: coming soon

New notes, tools and security news from FM TecHub by email, explained simply. Free. We're not collecting email addresses yet; see our privacy policy.

PortServiceStatus
SMTP/25Email updatesopening soon

Meanwhile, stay connected: