BGP EVPN TYPE-1 & TYPE-4 in action

 

🧠 Quick Recap Before Type-4

When an ESI (Ethernet Segment Identifier) is configured on dual-homed leafs:

  • Each leaf advertises:
    Type-1 Per-ESI → ESI discovery & mass withdrawal
    Type-1 Per-EVI → VLAN (EVI) participation, per-VLAN control

  • Remote VTEPs use these to know who shares the ESI.

Now, to decide which leaf forwards BUM traffic (Broadcast, Unknown, Multicast) for each VLAN,
they use Type-4 routes.


⚙️ What is a Type-4 Route?

Route TypeNamePurpose
Type-4Ethernet Segment Route (ES Route)Used for DF election between PEs sharing the same ESI

🔹 Content of Type-4 Route

Each PE advertising a shared ESI sends:

EVPN Type-4 Route ----------------- - ESI: 0000:0000:0000:0000:000010 - Originating Router’s IP (VTEP IP) - Route Distinguisher - Next Hop: VTEP IP - Extended Communities: - ES-Import RT (derived from ESI) - DF Algorithm (RFC7432 or RFC8584)

🧭 Putting It Together (Flow of Events)

Let’s take this topology again:

+----------- Spine (RR) -----------+ | | +--+--+ +--+--+ |Leaf1| |Leaf2| +--+--+ +--+--+ | | +--------- Shared Link -----------+ (ESI = 10) | +------+ |HostA | +------+ VLAN 10, VLAN 20

Step-by-Step DF Election Process

StepActionEVPN RouteDescription
1Leaf1, Leaf2 detect they share ESI=10Type-1 Per-ESIDiscover multihomed peers
2Both advertise VLANs on that ESIType-1 Per-EVI (Ethernet Tag = VLAN ID)Indicates which VLANs are active
3Both advertise ES routeType-4 (ES Route)Used for DF election
4Each PE learns others’ Type-4sNow both know the list of PEs in the ESI group
5Run DF election algorithm(default = Modulus algorithm)Deterministic: based on VLAN ID & VTEP IP
6Result → per-VLAN DF assignmentOne leaf becomes DF for VLAN 10, the other for VLAN 20
7DF starts forwarding BUM; non-DF blocks BUMUnicast flows are unaffected

🧮 DF Election Logic Example (Default Modulus)

DF = (VLAN-ID mod Number-of-PEs)

With 2 PEs:

VLANCalculationDF
VLAN 1010 mod 2 = 0Leaf1
VLAN 2020 mod 2 = 0Leaf1
VLAN 1111 mod 2 = 1Leaf2
VLAN 2121 mod 2 = 1Leaf2

➡️ So DF role alternates per VLAN.

⚙️ Modern implementations use HRW (Highest Random Weight) algorithm (RFC 8584), which is more stable.


🧩 Relationship Between Route Types

FunctionRoute TypeAdvertised perKey Use
ESI DiscoveryType-1 (Per-ESI)Once per ESIIdentify multihomed peers
VLAN ParticipationType-1 (Per-EVI)Once per VLANInput to DF election
DF ElectionType-4Once per ESICompute DF/non-DF per VLAN
MAC/IP ReachabilityType-2Per hostLearned over active PE(s)
Mass WithdrawalType-1 WithdrawalOn ESI failureFlush stale MACs

🛰️ Example Control Plane View (Simplified)

Leaf1 → Spine: Type-1 (ESI=10, ETAG=0) Type-1 (ESI=10, ETAG=10) Type-1 (ESI=10, ETAG=20) Type-4 (ESI=10, Origin=10.10.10.1) Leaf2 → Spine: Type-1 (ESI=10, ETAG=0) Type-1 (ESI=10, ETAG=10) Type-1 (ESI=10, ETAG=20) Type-4 (ESI=10, Origin=10.10.10.2)

When both Type-4 routes are received, each leaf runs DF election and decides:

VLANDFNon-DF
VLAN 10Leaf1Leaf2
VLAN 20Leaf2Leaf1

🧠 Summary

RouteScopeKey Function
Type-1 Per-ESI1 per ESIESI discovery & mass withdrawal
Type-1 Per-EVI1 per VLANDF election input (per-VLAN participation)
Type-41 per ESIDF election control (which PE is DF)

Comments

Popular posts from this blog

gNMI_with_grafana on containerlabs

EVPN Route type-1 & type-4 in action

Network Automation with ROBOT Framework