第177篇:EVPN IRB(Integrated Routing and Bridging)
关键词
IRB、集成路由桥接、Asymmetric IRB、Symmetric IRB、L3VNI、IP VPN
一、什么是 IRB
1.1 概念
IRB(Integrated Routing and Bridging) 指同一台设备同时具备二层桥接和三层路由能力。
在 EVPN+VXLAN 网络中,IRB 是 Leaf 交换机(PE)同时处理: - 桥接:同一子网内的二层转发(通过 L2 VNI) - 路由:不同子网间的三层转发(通过 L3 VNI 或 IP VPN)
1.2 为什么需要 IRB
数据中心典型场景:
租户 A 子网 10.1.1.0/24 ──┐
├── Leaf ── Spine ── Leaf ──── 租户 A 子网 10.2.2.0/24
租户 A 子网 10.1.2.0/24 ──┘
同一租户的不同子网需要三层互通
不同租户需要隔离
二、Asymmetric IRB(非对称 IRB)
2.1 工作原理
Asymmetric IRB 的含义是:只有 Ingress PE 做三层路由,Egress PE 只做二层桥接。
CE1(10.1.1.10, VNI 100) → CE2(10.2.2.10, VNI 200)
PE1(Ingress):
┌─────────────────────────────┐
│ ① 收到 IP 包 │
│ ② 查 VRF 路由 → 10.2.2.0/24 │
│ ③ 路由后重新封装 VXLAN │
│ ④ 使用 VNI 100(不是 200!)│
└──────────┬──────────────────┘
│ VXLAN (VNI 100)
▼
PE2(Egress):
┌─────────────────────────────┐
│ ⑤ 收到 VXLAN(VNI 100) │
│ ⑥ 查 MAC 表 → 10.2.2.10 │
│ ⑦ 桥接转发到 AC(VNI 200 的子网)│
└─────────────────────────────┘
2.2 关键问题
Asymmetric IRB 要求 Egress PE 必须学习所有远端 MAC 地址:
- PE2 需要知道 CE1 的 MAC(因为后续 CE2 回复 CE1 时需要)
- 即使 CE1 的流量只是"路过"PE2,PE2 也必须学习它的 MAC
这就是非对称的由来:Ingress 做路由(不对称的复杂工作),Egress 只做桥接。
2.3 优缺点
| 优点 | 缺点 |
|---|---|
| 实现简单(2009 年 VXLAN 早期方案) | Egress PE 必须学习所有 MAC(MAC 表膨胀) |
| 只需要 L2 VNI | 流量不经过 Egress 的三层处理 |
| 转发路径清晰 | ARP 抑制困难 |
结论:Asymmetric IRB 已不推荐使用。
三、Symmetric IRB(对称 IRB)
3.1 工作原理
Symmetric IRB 的含义是:Ingress PE 和 Egress PE 都做三层路由。
CE1(10.1.1.10, VNI 100) → CE2(10.2.2.10, VNI 200)
PE1(Ingress):
┌─────────────────────────────┐
│ ① 收到 IP 包 │
│ ② 查 VRF 路由 → 下一跳 PE2 │
│ ③ 封装 VXLAN(VNI 999= L3VNI)│
└──────────┬──────────────────┘
│ VXLAN (VNI 999, L3VNI)
▼
PE2(Egress):
┌─────────────────────────────┐
│ ④ 收到 VXLAN(VNI 999) │
│ ⑤ 查 VRF 路由 → 10.2.2.10 │
│ ⑥ 路由 → 封装 L2 VNI 200 的 VXLAN│
│ ⑦ 发送到 CE2(VNI 200) │
└─────────────────────────────┘
3.2 关键特性
使用 L3VNI(Layer 3 VNI) 在 PE 之间传递三层路由信息:
| 封装 | VNI | 用途 |
|---|---|---|
| L2 VNI(100/200) | 10.1.1.0/24 和 10.2.2.0/24 | 二层桥接 |
| L3 VNI(999) | 跨子网路由 | 三层路由 |
L3VNI 的好处:
- Egress PE 不需要学习远端 MAC(只需要 IP 路由)
- MAC 表:只保存本地 MAC(连接到自己的端口)
- IP 路由表:通过 BGP EVPN 同步
3.3 配置 L3VNI
# 定义 L3VNI
bridge-domain 999
vxlan vni 999
evpn
route-distinguisher 100:999
vpn-target 999:999 export-extcommunity
vpn-target 999:999 import-extcommunity
!
# 关联 VRF 和 L3VNI
ip vpn-instance TenantA
route-distinguisher 100:999
vpn-target 999:999 export-extcommunity
vpn-target 999:999 import-extcommunity
evpn
l3-vni 999 # 关联 L3VNI
!
interface Vlanif999
ip binding vpn-instance TenantA
ip address 10.99.99.1 255.255.255.0
4. 两种 IRB 对比
| 对比维度 | Asymmetric IRB | Symmetric IRB |
|---|---|---|
| Ingress PE | 做路由 | 做路由 |
| Egress PE | 只做桥接 | 也做路由 |
| VNI 类型 | 仅 L2 VNI | L2 VNI + L3 VNI |
| MAC 表规模 | Egress 学习所有 MAC | 仅本地 MAC |
| ARP 抑制 | 困难 | 容易 |
| 当前推荐 | ❌ | ✅ |
五、IP VPN over EVPN
5.1 场景
EVPN IRB 不仅支持传统桥接+路由,还可以作为 IP VPN 的承载:
IP VPN (VRF)
┌────────────────┐
│ Tenant A │
│ L3VNI=999 │
└────────────────┘
│
┌───────┼───────┐
│ │
VNI 100 VNI 200
(子网 A) (子网 B)
5.2 Type 5 路由
EVPN Type 5(IP Prefix Route) 专门用于发布 IP 前缀:
Type 5 路由(IP Prefix):
RD: 100:999
IP Prefix: 10.1.0.0/16
GW IP: 10.99.99.1
MPLS Label: 999(L3VNI)
Type 5 路由用于: - 将外部网络的路由引入 EVPN - 将 VXLAN 网络的路由发布到外部 - 连接传统三层网络
六、IRB 配置完整示例(华为)
6.1 完整配置
# PE1 上的 IRB 配置
#
# 1. L2 VNI(桥接域)
bridge-domain 10
vxlan vni 100
evpn
route-distinguisher 100:100
vpn-target 100:100 export-extcommunity
vpn-target 100:100 import-extcommunity
!
bridge-domain 20
vxlan vni 200
evpn
route-distinguisher 100:200
vpn-target 200:200 export-extcommunity
vpn-target 200:200 import-extcommunity
!
# 2. L3 VNI
bridge-domain 999
vxlan vni 999
evpn
route-distinguisher 100:999
vpn-target 999:999 export-extcommunity
vpn-target 999:999 import-extcommunity
!
# 3. VRF
ip vpn-instance TenantA
route-distinguisher 100:999
vpn-target 999:999 export-extcommunity
vpn-target 999:999 import-extcommunity
evpn
l3-vni 999
!
# 4. Anycast Gateway
interface Vlanif10
ip binding vpn-instance TenantA
ip address 10.1.1.1 255.255.255.0
mac-address 0000-5e00-0101
arp broadcast-detect
!
interface Vlanif20
ip binding vpn-instance TenantA
ip address 10.2.2.1 255.255.255.0
mac-address 0000-5e00-0101
arp broadcast-detect
!
# 5. AC 接口
interface GigabitEthernet0/0/0.10
vlan-type dot1q 10
bridge-domain 10
!
interface GigabitEthernet0/0/0.20
vlan-type dot1q 20
bridge-domain 20
6.2 验证
# 查看 VRF 路由
<PE1> display ip routing-table vpn-instance TenantA
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlanif10
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoopBack0
10.2.2.0/24 EVPN 255 0 2.2.2.2 Vlanif999
# 查看 MAC 表(Symmetric IRB 只学习本地 MAC)
<PE1> display bridge-domain 10 mac-address
MAC Address Type Interface
00e0-fc00-0001 Dynamic GE0/0/0.10
七、总结
| 知识点 | 核心要点 |
|---|---|
| IRB | 桥接 + 路由的集成 |
| Asymmetric IRB | 仅 Ingress 路由,Egress 只桥接(不推荐) |
| Symmetric IRB | Ingress 和 Egress 都路由(推荐) |
| L3VNI | 用于三层路由的 VNI,在 PE 之间传递 |
| Type 5 路由 | IP 前缀路由,用于连接外部网络 |
| VRF + L3VNI | 将 VRF 与 L3VNI 关联,实现三层互通 |
八、思考
- IRB 的英文全称是什么?它解决什么核心问题?
- Asymmetric IRB 和 Symmetric IRB 的核心区别是什么?
- 为什么 Symmetric IRB 需要 L3VNI?
- Symmetric IRB 相比 Asymmetric IRB 的最大优势是什么?
- EVPN Type 5 路由在 IRB 中起什么作用?
下篇预告:第178篇《VXLAN 报文封装与 UDP 端口》——深入 VXLAN 的数据面,理解 MAC-in-UDP 的封装结构、VNI 的作用以及 MTU 适配策略。