← Interview Prep

MP-BGP — Theory

Multiprotocol BGP end to end: AFI/SAFI, L3VPN (RD vs RT), EVPN route types, 6PE/6VPE, and how one session carries every address family.

Plain BGP-4 only knew how to advertise IPv4 unicast prefixes. Multiprotocol BGP (MP-BGP, RFC 4760) generalizes it: the same TCP session, the same finite-state machine, the same path attributes — but now it can carry any address family (IPv6, VPNv4, EVPN, multicast, flowspec) side by side. The reachability info is moved out of the classic IPv4-only NLRI fields into two new attributes so BGP itself stays protocol-agnostic:

A route is identified by an AFI/SAFI pair (Address Family / Subsequent Address Family). Reachable prefixes ride in MP_REACH_NLRI (which also carries the next-hop), and withdrawals ride in MP_UNREACH_NLRI. Everything else — AS_PATH, LOCAL_PREF, MED, communities — is reused unchanged across all families.

Why MP-BGP exists

Three additions turn BGP-4 into a multiprotocol control plane. They are the whole story, so keep them straight:

PieceTypePurpose
MP_REACH_NLRIPath attribute 14 (optional, non-transitive)Carries <AFI, SAFI, next-hop, NLRI...> — the reachable prefixes for one family, plus their next-hop. Replaces the IPv4-only NLRI + NEXT_HOP for non-IPv4 families.
MP_UNREACH_NLRIPath attribute 15 (optional, non-transitive)Carries <AFI, SAFI, NLRI...> to withdraw prefixes of that family. The multiprotocol equivalent of the Withdrawn Routes field.
Multiprotocol capabilityOPEN capability (code 1)Each peer advertises which (AFI, SAFI) pairs it supports. A family is active on the session only if both sides advertised it. No new session per family.

Address families — the AFI/SAFI table

AFI names the network-layer protocol (IPv4=1, IPv6=2, L2VPN=25); SAFI qualifies what kind of route it is. The pair is what you configure under address-family and what capability negotiation exchanges.

FamilyAFISAFICarries
IPv4 unicast11Plain Internet IPv4 routes.
IPv6 unicast21Plain Internet IPv6 routes.
IPv4 labeled-unicast (BGP-LU)14IPv4 prefix + MPLS label — inter-AS / seamless MPLS, SR label distribution.
IPv6 labeled-unicast (6PE)24IPv6 prefix + label over an MPLS IPv4 core.
VPNv4 (L3VPN)1128RD + IPv4 prefix + VPN label — MPLS L3VPN customer routes.
VPNv6 (6VPE)2128RD + IPv6 prefix + VPN label.
L2VPN EVPN2570MAC/IP, Ethernet A-D, multicast, ES, IP-prefix routes for VXLAN/MPLS.
MVPN (multicast VPN)1 / 25C-multicast / auto-discovery routes for NG-MVPN.
IPv4/IPv6 multicast (RPF)1 / 22Separate RPF topology for multicast (MBGP).
Flowspec1 / 2133 (134 for VPN)Traffic-filtering rules (RFC 8955) — distributed ACL/DDoS mitigation.
RT Constraint1132Route-Target membership NLRI (RFC 4684) — see scaling.

The key mental model

SAFI 128 (VPNv4/VPNv6) and SAFI 70 (EVPN) do not carry a bare IP prefix. They carry a structured NLRI — a Route Distinguisher prepended to make it globally unique, plus labels — and rely on Route Targets (extended communities) to decide which VRFs import it. RD and RT are different things; mixing them up is the #1 way to fail an L3VPN question.

MPLS L3VPN — RD vs RT, labels, next-hop

An MPLS L3VPN (RFC 4364) lets many customers share one provider core while keeping their routing tables isolated — even when two customers use the same 10.0.0.0/8. Two orthogonal problems, two different mechanisms:

Route Distinguisher (RD) — makes prefixes unique

Route Target (RT) — controls import/export

RD = uniqueness (structural), RT = reachability policy (who imports). You can change a customer's connectivity by editing RTs without touching the RD; you cannot fix overlapping-prefix collisions with RTs.

The VPN label and the next-hop

What a VPNv4 route looks like

PE2# show bgp vpnv4 unicast all 10.1.1.0/24
BGP routing table entry for 65000:100:10.1.1.0/24, version 7
                    └──RD──┘└──prefix──┘
Paths: (1 available, best #1)
  Local
    192.0.2.1 (metric 20) from 192.0.2.9 (192.0.2.9)   ← next-hop = PE1 loopback (via RR 192.0.2.9)
      Origin IGP, localpref 100, valid, internal, best
      Extended Community: RT:65000:100                  ← Route Target (import policy)
      mpls labels in/out nolabel/24016                  ← VPN label allocated by PE1
      Originator: 192.0.2.1, Cluster list: 192.0.2.9

Import into VRFs

PE1 (site A)                 P core (label switching)                 PE2 (site B)
 VRF CUST-A                                                            VRF CUST-A
 export RT 65000:100  ──▶  VPNv4: RD 65000:100 : 10.1.1.0/24  ──▶  import RT 65000:100
 redistribute CE route     next-hop 192.0.2.1, VPN label 24016        installs into CUST-A RIB
                           RT:65000:100                               (RD stripped, plain 10.1.1.0/24)

The receiving PE runs its normal BGP best path, then for each VRF checks: does any import RT match an RT on the route? If yes, it strips the RD and installs the plain customer prefix into that VRF, with the VPN label recorded for forwarding.

EVPN — one control plane for L2 and L3

EVPN (RFC 7432 for MPLS, RFC 8365 for VXLAN) uses MP-BGP (AFI 25 / SAFI 70) to distribute MAC and IP reachability, replacing flood-and-learn bridging with a BGP control plane. Like L3VPN it uses RD + RT; the difference is the NLRI is typed. Know the five route types:

TypeNameWhat it does
1Ethernet Auto-Discovery (A-D)Per-ES and per-EVI. Enables multihoming: fast withdrawal (mass MAC withdraw on link failure) and aliasing (load-balance to all PEs on an ES).
2MAC/IP AdvertisementThe workhorse: advertises a host MAC (L2) and optionally its MAC+IP binding (for ARP/ND suppression and L3 routing). Carries MAC mobility sequence.
3Inclusive Multicast Ethernet TagBuilds the BUM (broadcast/unknown-unicast/multicast) replication list per BD — ingress replication or an underlay multicast group.
4Ethernet Segment (ES)Discovers PEs attached to the same multihomed ES and runs Designated Forwarder (DF) election (which PE forwards BUM to the CE).
5IP Prefix RouteAdvertises an IP prefix (subnet/summary) decoupled from any MAC — pure L3, for routing to prefixes, external nets, or silent hosts.

Type-2 vs Type-5 (a favorite question)

Data plane: VXLAN vs MPLS

EVPN-VXLANEVPN-MPLS
EncapVXLAN (UDP/4789), VNI identifies the L2/L3 segmentMPLS label identifies the EVI/BD
UnderlayPlain IP fabric (leaf/spine), IGP + often no LDPMPLS core (LDP/RSVP/SR)
Typical useData-center fabricsService-provider / metro
Control planeIdentical — MP-BGP EVPN, same 5 route types, same RD/RT model

Bridging features EVPN gives you

6PE, 6VPE, and labeled unicast

Scaling: route reflectors and RT Constraint

Likely follow-up questions

Related: TCP — Theory & Mechanisms · Life of a Packet.