Network
VXLAN and EVPN: Layer 2 across racks and sites, and where the limits are
VXLAN wraps Ethernet frames in UDP, and EVPN distributes the corresponding MAC and IP addresses through BGP. Together they make a Layer 2 segment available in every rack and at every site. That solves old problems and at the same time enlarges the area across which a failure can spread.
Where classic VLANs end
A VLAN is a broadcast domain: all devices in it reach each other directly at Layer 2, without a router. The identifier in the Ethernet frame is 12 bits long, and the limit is 4,094 VLANs. The Spanning Tree Protocol (STP) prevents loops by blocking links. Ports and links that have been paid for therefore sit unused.1 RFC 7938 names further weaknesses: failures regularly affected the entire spanning tree domain. Multi-Chassis Link Aggregation (M-LAG), the attachment of a server to two switches, is not standardized and in most implementations does not scale beyond two devices.7
The obvious answer is routing all the way into the rack. But the same document also names the reasons why Layer 2 is in demand nonetheless: older applications that need direct Layer 2 adjacency or do not speak IP, and virtual machines that are meant to keep their IP address when they move.7 VXLAN and EVPN deliver this Layer 2 as an overlay, that is, as a logical network on top of a routed transport network, the underlay.
VXLAN: the encapsulation
Virtual eXtensible LAN (VXLAN) is described in RFC 7348, an informational document from August 2014. A VXLAN Tunnel End Point (VTEP), which is a switch or the hypervisor of a server, wraps the Ethernet frame in a UDP packet with destination port 4789 and sends it over IP to the VTEP behind which the destination sits. The VXLAN header carries a 24-bit segment identifier, the VXLAN Network Identifier (VNI). This allows around 16 million segments within one administrative domain.1
Encapsulation takes up space. Each frame is preceded by an outer Ethernet, IP and UDP header plus the 8-byte VXLAN header. With IPv4 in the underlay, that comes to 14 + 20 + 8 + 8 = 50 bytes by our own calculation, and to 70 bytes with IPv6, not counting an optional outer VLAN tag. If servers are to keep sending IP packets of 1,500 bytes, the underlay therefore has to carry IP packets of at least 1,550 bytes, or 1,570 bytes with IPv6. VTEPs must not fragment VXLAN packets. RFC 7348 therefore recommends raising the MTU in the transport network to match.1
RFC 7348 does not provide for a control plane: VTEPs learn addresses from the data traffic, and broadcasts as well as frames to unknown destinations go to one multicast group per VNI.1 This method, called “flood and learn”, scales poorly because flooding is constant and the underlay needs multicast routing.10
EVPN: the control plane
Ethernet VPN (EVPN) as specified in RFC 7432 moves learning into the routing protocol BGP: a switch learns the MAC address of an attached host locally and advertises it to all the others as a route.2 RFC 7432 was written for MPLS networks. RFC 8365 carries the method over to VXLAN; here the VNI sits in the fields that otherwise carry the MPLS label.3 EVPN has five route types:
Scroll sideways to see more columns.
| Type | Name | Purpose |
|---|---|---|
| 1 | Ethernet Auto-Discovery | Multihoming: fast failover when an attachment fails, load balancing across all participating switches |
| 2 | MAC/IP Advertisement | Advertises the MAC address of a host, optionally with its IP address; also carries host moves |
| 3 | Inclusive Multicast Ethernet Tag | Announces which VTEPs participate in a segment and sets up the distribution of broadcast and multicast |
| 4 | Ethernet Segment | Switches attached to the same multihomed device find each other and elect which one delivers broadcasts to it |
| 5 | IP Prefix | Advertises IP prefixes of any length, independent of individual MAC addresses |
Three functions matter most in operations:
- ARP suppression: Type 2 routes can carry the IP address alongside the MAC address. If the switch knows the mapping, it answers ARP requests itself instead of flooding them.2 RFC 9161 governs the details, down to the detection of duplicate IP addresses.4
- Multihoming: A server is attached to two or more switches by link aggregation. This group of links is called an Ethernet Segment and carries a 10-byte identifier. In All-Active mode, all participating switches forward at the same time.2 Under VXLAN, the “Local Bias” procedure keeps frames from flowing back into the segment they came from.3
- Moves and loops: If a MAC address shows up at a different switch, that switch increments a sequence number in the route. If an address changes location five times within 180 seconds (default values), it is considered a duplicate: the switch reports this and suspends the advertisements for that address.2
Routing between segments and the underlay
Hosts in different segments need a router. RFC 9135 describes Integrated Routing and Bridging (IRB): the switch at the rack does the routing itself instead of redirecting traffic to a central device. In the asymmetric model, every switch has to know all of a tenant's segments. In the symmetric model, the locally attached ones are enough; traffic between the switches runs over a VNI that belongs to the tenant's routing instance. The recommendation is that all switches use the same gateway IP and the same gateway MAC. A host then has nothing to relearn after a move.5 Type 5 routes add IP prefixes to this, for example for networks behind a virtual firewall or for the handoff to the wide area network.6
The underlay is a pure IP network. For it, RFC 7938 describes the Clos topology, known as leaf-spine, with EBGP as the only routing protocol and Equal-Cost Multipath (ECMP) for load balancing across all links.7 STP is no longer needed between the switches.
Connecting sites
For interconnecting data centers, RFC 8365 names two approaches: gateways at the edge of each site, or border routers that merely pass the routes on.3 RFC 9014 works out the gateway solution. The wide area network in between can run VPLS, EVPN over MPLS or EVPN over VXLAN. The gateway can control which MAC addresses are advertised into a site. Alternatively, it can install an “Unknown MAC Route”: frames to unknown destinations then go to the gateway and are not flooded. Proxy ARP on the gateway keeps out ARP flooding from outside.8
Whether a second site should be in the same segment at all is a question of architecture. Our article on regions and availability zones describes how sites can be planned as separate failure domains.
The limits: Layer 2 enlarges the failure domain
EVPN reduces flooding; it does not remove the broadcast domain. RFC 7938 notes that Ethernet networks are susceptible to broadcast and unicast storms and that only a fully routed design significantly reduces the size of the failure domains.7 RFC 6820 adds: every device has to process broadcasts, a storm can bring down a network in whole or in part, and overlays do not eliminate address resolution traffic, they relocate it.9 A loop in a rack at site A also reaches site B through a stretched segment.
The second limit is distance. A stretched segment does nothing to change the latency between the sites. Synchronous storage replication and cluster heartbeats, the typical users of such segments, tolerate only low latency. If the link fails, each side takes itself for the surviving one. For that case, the cluster needs a tiebreaker at a third location.
- Stretching is justified for legacy applications with a Layer 2 dependency and for moving virtual machines while keeping the same IP address.7 Time-limited migrations between sites are a further case.
- Layer 3 is the better design when the application provides its own redundancy: through replication at the application level, load balancers, DNS or anycast. Each site keeps its own subnets, and a Layer 2 failure stays local.
Planning checklist
- End-to-end MTU: Throughout the underlay and on every link between sites, at least 50 bytes (IPv4) or 70 bytes (IPv6) above the MTU of the servers, verified with full-size packets and the Don't Fragment bit set.
- VNI plan: Fixed mapping of VLAN to VNI, separate ranges for segments and routing instances, unique across all sites.
- Multihoming: Define the identifier for each Ethernet Segment, and test the failure of a switch and of individual links before going live.
- Limit broadcast: Enable ARP suppression, set storm control on the access ports, keep segments small.
- Site interconnection: Define at the gateway which segments and addresses leave the site.
- Monitoring: Monitor BGP sessions, the number of MAC routes per VNI, MAC address moves and duplicate address reports.
We support you with Layer 2 Ethernet connections between sites and with our managed network service for planning and operations. Our article on SONiC and open network operating systems covers which software can run on the switches.
Sources
- IETF: RFC 7348: Virtual eXtensible Local Area Network (VXLAN), August 2014
- IETF: RFC 7432: BGP MPLS-Based Ethernet VPN, February 2015
- IETF: RFC 8365: A Network Virtualization Overlay Solution Using Ethernet VPN (EVPN), March 2018
- IETF: RFC 9161: Operational Aspects of Proxy ARP/ND in Ethernet Virtual Private Networks, January 2022
- IETF: RFC 9135: Integrated Routing and Bridging in Ethernet VPN (EVPN), October 2021
- IETF: RFC 9136: IP Prefix Advertisement in Ethernet VPN (EVPN), October 2021
- IETF: RFC 7938: Use of BGP for Routing in Large-Scale Data Centers, August 2016
- IETF: RFC 9014: Interconnect Solution for Ethernet VPN (EVPN) Overlay Networks, May 2021
- IETF: RFC 6820: Address Resolution Problems in Large Data Center Networks, January 2013
- IETF: RFC 9469: Applicability of Ethernet Virtual Private Network (EVPN) to Network Virtualization over Layer 3 (NVO3) Networks, September 2023