第180篇:VXLAN underlay/overlay 架构设计

关键词:Underlay、Overlay、IP Fabric、SPINE-LEAF、ECMP、BGP EVPN、网络虚拟化

一、引言

VXLAN 网络由两个逻辑层面组成:Underlay(底层物理网络)和 Overlay(虚拟覆盖网络)。Underlay 提供 VTEP 之间的 IP 连通性,Overlay 构建跨物理网络的虚拟二层或三层网络。正确设计 Underlay 和 Overlay 的架构,是 VXLAN 网络稳定运行和高效转发的基础。Underlay 设计关注 IP 路由和负载均衡,Overlay 设计关注虚拟网络隔离和扩展性。

二、核心概念

2.1 Underlay 与 Overlay 的关系

层面 职责 技术
Underlay VTEP 间 IP 连通性 OSPF/IS-IS/BGP, ECMP
Overlay 虚拟网络构建 VXLAN/EVPN/VNI

Underlay 与 Overlay 的关系 - 图示

2.2 Underlay 架构:SPINE-LEAF(Clos)

SPINE-LEAF 是当前数据中心最主流的 Underlay 架构:

层级 角色 连接方式
Leaf 接入层(VTEP 所在) 上行全互联到所有 Spine
Spine 核心层 下行全互联到所有 Leaf

SPINE-LEAF 特点: - 无核心/汇聚/接入的层次,所有路径等距(最短路径=2跳) - 天然支持 ECMP(等代价多路径) - 东西向流量不经过"核心",直接在 Leaf 间通过 Spine 转发

2.3 Overlay 架构设计

设计要素 说明
VNI 规划 24 位 VNI 空间(16M),按租户/业务划分
RD/RT 规划 每 VNI 独立 RD/RT
EVPN 路由反射器 集中式 RR 或分布式 RR
网关部署 集中式或分布式网关

三、技术细节

3.1 Underlay ECMP 设计

SPINE-LEAF 架构中,Leaf 到 Leaf 的流量通过多条 Spine 路径进行 ECMP 负载均衡:

N 个 Spine 每 Leaf 到 Spine 链路数 Leaf-Leaf 路径数
4 4 4
8 8 8
16 16 16

ECMP 哈希:Underlay 使用五元组(源IP、目的IP、源端口、目的端口、协议)进行 ECMP 哈希,确保同一流的数据包走相同路径。

3.2 Underlay IGP 设计

协议 适用场景
IS-IS 大型数据中心(扩展性好,TE 支持)
OSPF 中小型数据中心(配置简单)
BGP(iBGP) 超大型数据中心(百万级路由)

Metric 设计:SPINE-LEAF 中所有链路 Metric 相同(如 10),确保 ECMP 生效。

3.3 Overlay EVPN 控制平面设计

Overlay EVPN 控制平面设计 - 图示

四、实战配置/案例分析

4.1 Underlay IS-IS 配置(SPINE-LEAF)

# ========== Leaf配置 ==========
[Leaf1] isis 1
[Leaf1-isis1] network-entity 49.0001.0000.0000.0001.00
[Leaf1-isis1] cost-style wide
[Leaf1-isis1] is-level level-2

[Leaf1] interface 100ge 1/0/1
[Leaf1-100GE1/0/1] ip address 10.0.1.1 30
[Leaf1-100GE1/0/1] isis enable 1
[Leaf1-100GE1/0/1] isis cost 10

[Leaf1] interface 100ge 1/0/2
[Leaf1-100GE1/0/2] ip address 10.0.1.5 30
[Leaf1-100GE1/0/2] isis enable 1
[Leaf1-100GE1/0/2] isis cost 10

# ========== Spine配置 ==========
[Spine1] isis 1
[Spine1-isis1] network-entity 49.0001.0000.0000.0010.00
[Spine1-isis1] cost-style wide
[Spine1-isis1] is-level level-2

[Spine1] interface 100ge 1/0/1
[Spine1-100GE1/0/1] ip address 10.0.1.2 30
[Spine1-100GE1/0/1] isis enable 1
[Spine1-100GE1/0/1] isis cost 10

4.2 Overlay VNI 规划

# VNI规划表:
# VNI 1000-1999: 租户A
# VNI 2000-2999: 租户B
# VNI 3000-3999: 租户C

# RD规划: VTEP_IP:VNI
# RT规划: VNI:VNI

[Leaf1] vxlan vni 1000
[Leaf1-vxlan-vni-1000] route-distinguisher 10.1.1.1:1000
[Leaf1-vxlan-vni-1000] route-target both evpn 1000:1000
[Leaf1-vxlan-vni-1000] vxlan-source-interface LoopBack 0
[Leaf1-vxlan-vni-1000] mac-ip-advertisement enable

4.3 故障排查:Underlay ECMP 不均衡

故障场景:VTEP 间流量集中在少数链路上,ECMP 负载均衡效果差。

# Step 1: 检查IS-IS路由
<Leaf1> display ip routing-table 10.1.2.1
  Destination: 10.1.2.1/32
  Protocol: IS-IS
  Preference: 15
  Cost: 20
  NextHop:
    10.0.1.2 (100GE1/0/1)
    10.0.1.6 (100GE1/0/2)
    10.0.1.10 (100GE1/0/3)
  # 3条等价路由, ECMP应生效

# Step 2: 检查ECMP哈希
<Leaf1> display ip route-statistics 10.1.2.1
  # 流量集中在100GE1/0/1(80%), 其他两条链路<10%
  # 根因: ECMP哈希基于源IP, 如果源IP单一, 哈希不均衡

# Step 3: 调整ECMP哈希算法
[Leaf1] ip route-hash include sport dport
  # 加入源端口和目的端口参与哈希

# Step 4: 验证
<Leaf1> display ip route-statistics 10.1.2.1
  # 流量分布均衡: 33%/34%/33%

四(续)、高级主题

4.4 Underlay BGP-LS(链路状态)集成

BGP-LS 将 Underlay IGP 的链路状态信息通过 BGP 传递给控制器,实现集中式路径计算:

# Leaf/Spine: 启用BGP-LS
[Spine1] bgp 65001
[Spine1-bgp-65001] bgp-ls enable
[Spine1-bgp-65001] bgp-ls router-id 10.0.10.1
[Spine1-bgp-65001] bgp-ls iis enable
  # 发布IS-IS链路状态到BGP

# BGP-LS Collector(控制器)
[Controller] bgp 65001
[Controller-bgp-65001] peer 10.0.10.1 as-number 65001
[Controller-bgp-65001] address-family bgp-ls-ipv4-unicast
[Controller-bgp-65001-bgp-ls] peer 10.0.10.1 enable

4.5 Overlay 多租户 VNI 规划模板

租户 VNI 范围 RD 格式 RT 格式 用途
租户 A 1000-1099 10.1.1.1:VNI VNI:VNI 生产环境
租户 A 1100-1199 10.1.1.1:VNI VNI:VNI 测试环境
租户 B 2000-2099 10.1.1.2:VNI VNI:VNI 生产环境
租户 B 2100-2199 10.1.1.2:VNI VNI:VNI 测试环境
管理网 4000-4099 10.1.1.99:VNI VNI:VNI 运维管理

4.6 Underlay 保护机制

保护类型 实现方式 切换时间 说明
链路保护 物理聚合(Eth-Trunk/LACP) <50ms 多条物理链路绑定
节点保护 Underlay ECMP 多路径 1-3s Spine 故障后 IGP 收敛
BFD 加速 BFD for IS-IS/OSPF 10-50ms 加速 IGP 邻居检测
Flex-Algo IS-IS Flex-Algo 1-3s 按延迟/丢包选路
# Underlay BFD for IS-IS配置
[Leaf1] isis 1
[Leaf1-isis1] bfd enable
[Leaf1-isis1] bfd min-tx-interval 10
[Leaf1-isis1] bfd min-rx-interval 10

# Eth-Trunk链路聚合
[Leaf1] interface Eth-Trunk 10
[Leaf1-Eth-Trunk10] trunkport 100ge 1/0/1 to 4
[Leaf1-Eth-Trunk10] mode lacp-static
[Leaf1-Eth-Trunk10] isis enable 1

4.7 Overlay 跨数据中心设计

当 VXLAN 需要跨多个数据中心(DC)时,需要考虑:

设计考量 方案 说明
Underlay 跨 DC OTN/WDM + MPLS 低延迟专线互联
Overlay 跨 DC EVPN BGP RR 集中部署 跨 DC MAC/IP 路由同步
带宽保障 SRv6 TE / MPLS TE 跨 DC 流量工程
延迟敏感业务 本地网关优先 东西向流量本地终止

五、总结

项目 要点
Underlay 提供 VTEP 间 IP 连通性,使用 SPINE-LEAF + ECMP
Overlay 构建虚拟网络,使用 VXLAN + EVPN
SPINE-LEAF 等距架构,天然 ECMP,所有路径最优
IGP 选择 IS-IS(大型)、OSPF(中小)、BGP(超大型)
VNI 规划 按租户/业务划分 VNI 段,RD/RT 全局唯一

思考

  1. SPINE-LEAF 架构中,如果某个 Spine 节点故障,Underlay ECMP 如何重新收敛?对 Overlay 的 VXLAN 隧道有什么影响?
  2. Underlay 使用 IS-IS Level-2 还是 Level-1-2?SPINE-LEAF 架构下 Area 如何划分?
  3. 如果 Overlay 的 VXLAN 隧道横跨多个 Underlay 区域(如跨地域数据中心),Underlay 设计需要考虑什么?

下篇预告:第181篇:SD-WAN 基本概念:控制面与数据面分离