VXLAN + EVPN 分布式网关实验手册
适用平台:华为 eNSP(CE6800 + AR6700 + S5700)
配置来源:题目给定配置。已按配置依赖关系重新排序,删除了交互式确认字符 y,并补充了必要说明。
说明:以下命令代码块中以 # 开头的行是注释,不需要在设备上输入。
一、实验拓扑与设备映射
本实验使用 Underlay ISIS + BGP EVPN Overlay,两台 Leaf(CE68001、CE68003)部署分布式任意播网关,Spine(CE68002)作为 BGP RR,AR6700 模拟外部网络出口。
| 配置中名称 |
拓扑设备 |
角色 |
LoopBack0 |
主要职责 |
| ce1 |
CE68001 |
Leaf-1 |
1.1.1.1/32 |
接入 VLAN10/20,分布式网关,EVPN IRB 发布 |
| spine |
CE68002 |
Spine / BGP RR |
2.2.2.2/32 |
Underlay 骨干、EVPN 路由反射、外部网络接入 |
| ce3 |
CE68003 |
Leaf-2 |
3.3.3.3/32 |
接入 VLAN10/20,分布式网关,EVPN IRB 发布 |
| border |
AR6700 |
外部网络路由器 |
8.8.8.8/32 |
通过 OSPF 与 Spine 的 DHCP 实例互通 |
| s1 |
左侧 S5700 |
接入交换机 |
- |
VLAN10/20 接入与 trunk 上联 |
| s2 |
右侧 S5700 |
接入交换机 |
- |
VLAN10/20 接入与 trunk 上联 |
二、设备互联接口地址表
2.1 三层互联(Underlay 与外部网络)
| 本端设备 |
本端接口 |
本端地址 |
对端设备 |
对端接口 |
对端地址 |
用途 |
| CE68001(ce1) |
GE1/0/1 |
10.1.12.1/24 |
CE68002(spine) |
GE1/0/1 |
10.1.12.2/24 |
ISIS Underlay |
| CE68003(ce3) |
GE1/0/2 |
10.1.24.3/24 |
CE68002(spine) |
GE1/0/2 |
10.1.24.2/24 |
ISIS Underlay |
| CE68002(spine) |
GE1/0/4 |
200.1.1.1/24(绑定 VPN DHCP) |
AR6700(border) |
GE0/0/4 |
200.1.1.2/24 |
外部网络互联 / OSPF |
| CE68001(ce1) |
LoopBack0 |
1.1.1.1/32 |
- |
- |
- |
NVE 源 / BGP Peer |
| CE68002(spine) |
LoopBack0 |
2.2.2.2/32 |
- |
- |
- |
ISIS / NVE 源 / BGP RR |
| CE68003(ce3) |
LoopBack0 |
3.3.3.3/32 |
- |
- |
- |
NVE 源 / BGP Peer |
| AR6700(border) |
LoopBack0 |
8.8.8.8/32 |
- |
- |
- |
外部网络测试地址 |
注:Spine 的 GE1/0/1.100 按原配置保留 arp proxy enable;该子接口未配置 IP。
2.2 二层接入(VLAN / BD / VNI)
| 本端设备 |
本端接口 |
封装 / VLAN |
对端设备 |
对端接口 |
对应 BD / VNI |
| CE68001 |
GE1/0/3.10 |
802.1Q vid 10 |
S1(左 S5700) |
GE0/0/3(trunk) |
BD10 / VNI 10 |
| CE68001 |
GE1/0/3.20 |
802.1Q vid 20 |
S1(左 S5700) |
GE0/0/3(trunk) |
BD20 / VNI 20 |
| CE68003 |
GE1/0/3.10 |
802.1Q vid 10 |
S2(右 S5700) |
GE0/0/3(trunk) |
BD10 / VNI 10 |
| CE68003 |
GE1/0/3.20 |
802.1Q vid 20 |
S2(右 S5700) |
GE0/0/3(trunk) |
BD20 / VNI 20 |
| S1 |
GE0/0/1 |
access vlan 10 |
VPC7 eth0 |
- |
IP 10.1.10.1/24 |
| S1 |
GE0/0/2 |
access vlan 20 |
VPC8 eth0 |
- |
IP 10.1.20.1/24 |
| S2 |
GE0/0/1 |
access vlan 10 |
VPC9 eth0 |
- |
IP 10.1.10.2/24 |
| S2 |
GE0/0/2 |
access vlan 20 |
VPC10 eth0 |
- |
IP 10.1.20.2/24 |
注:拓扑图中 CE68003 下联接口标注较模糊;按给定配置,GE1/0/2 用于连接 Spine(10.1.24.3/24),GE1/0/3.10/.20 用于下联 S2,请以配置为准。
2.3 网关、BGP、VNI 与 RT 规划
分布式网关(两端配置完全一致,MAC 必须相同):
| 设备 |
网关接口 |
IP / 掩码 |
MAC |
关键配置 |
| CE68001、CE68003 |
Vbdif10 |
10.1.10.254/24 |
0000-005e-0001 |
vxlan anycast-gateway enable、arp collect host enable |
| CE68001、CE68003 |
Vbdif20 |
10.1.20.254/24 |
0000-005e-0002 |
vxlan anycast-gateway enable、arp collect host enable |
BGP EVPN 邻居:
| 设备 |
本地地址 |
Peer |
AS |
EVPN 策略 |
| CE68001 |
1.1.1.1 |
2.2.2.2 |
100 |
policy vpn-target,advertise irb |
| CE68003 |
3.3.3.3 |
2.2.2.2 |
100 |
policy vpn-target,advertise irb |
| CE68002 |
2.2.2.2 |
1.1.1.1、3.3.3.3 |
100 |
undo policy vpn-target,reflect-client,advertise irb |
VPN / VNI / RT:
| 对象 |
位置 |
RD |
ERT |
IRT |
VNI |
| vpn-instance test |
CE1 / CE3 |
100:200 |
100:200(普通 + evpn) |
100:200(普通 + evpn) |
5010(L3VNI) |
| BD10 EVPN 实例 |
CE1 / CE3 |
100:10 |
100:10 evpn、100:200 evpn |
100:10 evpn |
10(L2VNI) |
| BD20 EVPN 实例 |
CE1 / CE3 |
100:20 |
100:20 evpn、100:200 evpn |
100:20 evpn |
20(L2VNI) |
| vpn-instance DHCP |
Spine |
1:2 |
100:201 evpn |
100:201 evpn、100:200 evpn |
101 |
三、配置顺序总览
配置必须按依赖顺序进行,否则邻居起不来或路由学不到:
- 接入交换机 S1 / S2:创建 VLAN、配置 access 与 trunk。
- Underlay 三层:配置 LoopBack0、互联口 IP,并使能 ISIS(先基础 IP 可达,再跑路由)。
- EVPN 全局与业务实例:
evpn-overlay enable,创建 VPN 实例、BD 与 EVPN 实例。
- 分布式网关 Vbdif:绑定 VPN 实例,配置任意播网关与 ARP 主机收集。
- 用户侧接入子接口:GE1/0/3.10、GE1/0/3.20 dot1q 绑定 BD。
- NVE 接口:指定 source LoopBack,L2VNI 通过 BGP 建立头端复制列表。
- BGP / EVPN:建立 LoopBack 邻居,配置 RR 与 IRB 通告。
- 外部网络互通:AR6700 的 OSPF,以及 Spine 上 DHCP 实例的 OSPF/BGP 双向引入。
- PC 地址与业务验证:配置主机 IP/网关,检查隧道、路由与连通性。
四、按序配置命令
步骤 1:配置接入交换机 S1(左 S5700)
system-view
sysname S1
vlan batch 10 20
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
quit
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
quit
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
quit
#
save
步骤 1(续):配置接入交换机 S2(右 S5700)
system-view
sysname S2
vlan batch 10 20
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
quit
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
quit
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
quit
#
save
步骤 2:配置 Underlay 三层(ISIS)
先完成 LoopBack 与互联口 IP,再使能 ISIS。CE1、Spine、CE3 的 NET 必须不同。
CE68001(ce1):
system-view
sysname CE1
#
isis 1
is-level level-2
cost-style wide
network-entity 49.0001.0000.0000.0001.00
quit
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
isis enable 1
quit
#
interface GE1/0/1
undo portswitch
ip address 10.1.12.1 255.255.255.0
isis enable 1
quit
CE68002(spine):
system-view
sysname spine
#
isis 1
is-level level-2
cost-style wide
network-entity 49.0001.0000.0000.0002.00
quit
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
isis enable 1
quit
#
interface GE1/0/1
undo portswitch
ip address 10.1.12.2 255.255.255.0
isis enable 1
quit
#
interface GE1/0/1.100
arp proxy enable
quit
#
interface GE1/0/2
undo portswitch
ip address 10.1.24.2 255.255.255.0
isis enable 1
quit
CE68003(ce3):
system-view
sysname CE3
#
isis 1
is-level level-2
cost-style wide
network-entity 49.0001.0000.0000.0003.00
quit
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
isis enable 1
quit
#
interface GE1/0/2
undo portswitch
ip address 10.1.24.3 255.255.255.0
isis enable 1
quit
此时应验证三台设备的 LoopBack 互相可达:
display isis peer
ping -a 1.1.1.1 2.2.2.2
ping -a 3.3.3.3 2.2.2.2
步骤 3:EVPN 全局、VPN 实例与 BD/EVPN 实例
CE68001(ce1):
evpn-overlay enable
#
ip vpn-instance test
ipv4-family
route-distinguisher 100:200
vpn-target 100:200 export-extcommunity
vpn-target 100:200 import-extcommunity
vpn-target 100:200 export-extcommunity evpn
vpn-target 100:200 import-extcommunity evpn
vxlan vni 5010
quit
quit
#
bridge-domain 10
vxlan vni 10
evpn
route-distinguisher 100:10
vpn-target 100:10 export-extcommunity
vpn-target 100:10 import-extcommunity
vpn-target 100:200 export-extcommunity
quit
quit
#
bridge-domain 20
vxlan vni 20
evpn
route-distinguisher 100:20
vpn-target 100:20 export-extcommunity
vpn-target 100:20 import-extcommunity
vpn-target 100:200 export-extcommunity
quit
quit
CE68003(ce3):(与 CE1 相同)
evpn-overlay enable
#
ip vpn-instance test
ipv4-family
route-distinguisher 100:200
vpn-target 100:200 export-extcommunity
vpn-target 100:200 import-extcommunity
vpn-target 100:200 export-extcommunity evpn
vpn-target 100:200 import-extcommunity evpn
vxlan vni 5010
quit
quit
#
bridge-domain 10
vxlan vni 10
evpn
route-distinguisher 100:10
vpn-target 100:10 export-extcommunity
vpn-target 100:10 import-extcommunity
vpn-target 100:200 export-extcommunity
quit
quit
#
bridge-domain 20
vxlan vni 20
evpn
route-distinguisher 100:20
vpn-target 100:20 export-extcommunity
vpn-target 100:20 import-extcommunity
vpn-target 100:200 export-extcommunity
quit
quit
CE68002(spine):外部网络 VPN 实例
evpn-overlay enable
#
ip vpn-instance DHCP
ipv4-family
route-distinguisher 1:2
vpn-target 100:201 export-extcommunity evpn
vpn-target 100:201 import-extcommunity evpn
vpn-target 100:200 import-extcommunity evpn
vxlan vni 101
quit
quit
关键点:Spine 的 DHCP 实例 IRT 必须包含 100:200 evpn,才能接收 Leaf 侧 BD ERT 携带的 100:200,进而生成远端主机路由。
步骤 4:配置分布式网关 Vbdif(CE1 与 CE3 完全相同)
interface Vbdif10
ip binding vpn-instance test
ip address 10.1.10.254 255.255.255.0
mac-address 0000-005e-0001
vxlan anycast-gateway enable
arp collect host enable
quit
#
interface Vbdif20
ip binding vpn-instance test
ip address 10.1.20.254 255.255.255.0
mac-address 0000-005e-0002
vxlan anycast-gateway enable
arp collect host enable
quit
两台 Leaf 的 Vbdif MAC 必须一致,否则双活网关会出现 ARP/MAC 漂移。
步骤 5:配置用户侧接入子接口(CE1 与 CE3)
CE68001(ce1):
interface GE1/0/3.10 mode l2
encapsulation dot1q vid 10
bridge-domain 10
quit
#
interface GE1/0/3.20 mode l2
encapsulation dot1q vid 20
bridge-domain 20
quit
CE68003(ce3):
interface GE1/0/3.10 mode l2
encapsulation dot1q vid 10
bridge-domain 10
quit
#
interface GE1/0/3.20 mode l2
encapsulation dot1q vid 20
bridge-domain 20
quit
步骤 6:配置 NVE 接口
CE68001(ce1):
interface Nve1
source 1.1.1.1
vni 10 head-end peer-list protocol bgp
vni 20 head-end peer-list protocol bgp
quit
CE68003(ce3):
interface Nve1
source 3.3.3.3
vni 10 head-end peer-list protocol bgp
vni 20 head-end peer-list protocol bgp
quit
CE68002(spine):
interface Nve1
source 2.2.2.2
quit
步骤 7:配置 BGP / EVPN(AS 100)
CE68001(ce1):
bgp 100
private-4-byte-as enable
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
#
ipv4-family unicast
peer 2.2.2.2 enable
quit
#
l2vpn-family evpn
policy vpn-target
peer 2.2.2.2 enable
peer 2.2.2.2 advertise irb
quit
quit
CE68003(ce3):
bgp 100
private-4-byte-as enable
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
#
ipv4-family unicast
peer 2.2.2.2 enable
quit
#
l2vpn-family evpn
policy vpn-target
peer 2.2.2.2 enable
peer 2.2.2.2 advertise irb
quit
quit
CE68002(spine,RR):
bgp 100
private-4-byte-as enable
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack0
#
ipv4-family unicast
peer 1.1.1.1 enable
peer 3.3.3.3 enable
quit
#
l2vpn-family evpn
undo policy vpn-target
peer 1.1.1.1 enable
peer 1.1.1.1 advertise irb
peer 1.1.1.1 reflect-client
peer 3.3.3.3 enable
peer 3.3.3.3 advertise irb
peer 3.3.3.3 reflect-client
quit
quit
关键点:Spine 作为 RR 必须 undo policy vpn-target,否则无法接收并反射 Leaf 的 IRB 路由。
步骤 8:配置外部网络与路由互通
CE68002(spine):GE1/0/4 绑定 DHCP 实例 + OSPF 2 + BGP 互引
interface GE1/0/4
undo portswitch
ip binding vpn-instance DHCP
ip address 200.1.1.1 255.255.255.0
quit
#
ospf 2 router-id 2.2.2.2 vpn-instance DHCP
import-route bgp
area 0.0.0.0
network 101.1.1.1 0.0.0.0
network 200.1.1.1 0.0.0.0
quit
quit
#
bgp 100
ipv4-family vpn-instance DHCP
import-route ospf 2
advertise l2vpn evpn
quit
quit
AR6700(border):
system-view
sysname border
#
dhcp enable
#
interface GE0/0/4
ip address 200.1.1.2 255.255.255.0
ospf enable 1 area 0.0.0.0
quit
#
interface LoopBack0
ip address 8.8.8.8 255.255.255.255
ospf enable 1 area 0.0.0.0
quit
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
quit
quit
#
save
步骤 9:配置 PC 地址
| 主机 |
IP / 掩码 |
默认网关 |
接入位置 |
| VPC7 |
10.1.10.1/24 |
10.1.10.254 |
S1 GE0/0/1(VLAN 10) |
| VPC8 |
10.1.20.1/24 |
10.1.20.254 |
S1 GE0/0/2(VLAN 20) |
| VPC9 |
10.1.10.2/24 |
10.1.10.254 |
S2 GE0/0/1(VLAN 10) |
| VPC10 |
10.1.20.2/24 |
10.1.20.254 |
S2 GE0/0/2(VLAN 20) |
五、验证命令与预期结果
邻居与隧道:
display isis peer # CE1/Spine/CE3 之间 ISIS 为 Up
display bgp peer # 1.1.1.1、3.3.3.3 与 2.2.2.2 为 Established
display bgp evpn all routing-table # 能看到 IRB(Type-2)路由
display vxlan tunnel # CE1 <-> CE3 的 VNI 10/20 隧道 Up
display evpn route mac-ip # 能看到对端主机 MAC/IP
路由与转发表:
display ip routing-table vpn-instance test # CE1/CE3 有对端 32 位主机路由
display ip routing-table vpn-instance DHCP # Spine 有 8.8.8.8/32 与外部网段
display arp vpn-instance test # 有 10.1.10.x、10.1.20.x 的 ARP
display current-configuration interface Nve1
业务连通性测试:
| 测试 |
预期 |
| VPC7 ping VPC9(10.1.10.1 → 10.1.10.2) |
通,同 VLAN 跨 Leaf 二层转发 |
| VPC7 ping VPC8 / VPC10(跨 VLAN) |
通,经分布式网关转发 |
| VPC7 ping 8.8.8.8 |
通,经 BGP EVPN → Spine DHCP 实例 → OSPF → AR6700 |
六、关键注意事项与排错
- RT 匹配是重点:BD10/20 的 EVPN 实例必须携带
vpn-target 100:200 export-extcommunity evpn,与 CE1/CE3 上 vpn-instance test 的 100:200 import-extcommunity evpn 匹配,远端才能生成 32 位主机路由。
- RR 必须关闭 RT 过滤:Spine 在
l2vpn-family evpn 下执行 undo policy vpn-target,否则不接收/不反射 Leaf 路由。
- IRB 双向通告:Leaf 与 Spine 两侧都要
peer x.x.x.x advertise irb,否则主机路由无法双向传递。
- Anycast 网关一致性:两台 Leaf 的 Vbdif10/20 地址与 MAC 必须完全一致,并开启
arp collect host enable。
- VLAN 与 dot1q 一致:S5700 trunk 需放行 VLAN 10/20;CE 子接口
encapsulation dot1q vid 10/20 必须对应。
- BGP 基于 LoopBack:先保证 ISIS Underlay 的 LoopBack 互通,再建立 BGP EVPN 邻居。
- 原配置中的
y 是命令交互确认,不是配置命令,已在手册中删除。
- AR6700 的 OSPF router-id 写为 3.3.3.3,与 CE68003 的 LoopBack0 相同(不同设备、不同协议,一般不影响本实验);生产/排错时建议改为 8.8.8.8 以免混淆。
- Spine 的
ospf 2 中 network 101.1.1.1 0.0.0.0 在给定配置里没有对应接口,该 network 不会生效。如需完整实验,可补建 interface LoopBack1 并绑定 VPN DHCP、地址 101.1.1.1/32 且使能 ospf 2 area 0;否则可删除该行。
- 接口编号核对:拓扑图中 CE68003 下联标注可能与配置不一致,请按本手册接口表(GE1/0/2 上联、GE1/0/3.10/.20 下联)连线。
- 每台设备配置完成后执行
save 保存配置。
评论 0
说说你打算用它练哪部分?十个字就行,不用登录。
有话要说?写第一条评论