本文将使用华为 AR2240 系列路由器,完整演示如何在 VRP(V200R003C00)平台上搭建多 VRF 隔离的 MPLS L3VPN 网络。
如果你想学习如何在开源 Linux 平台上实现同等架构,也可以对比参考本系列的姐妹篇:《基于 Debian Linux 与 FRR 搭建 MPLS L3VPN 骨干网》。
实验拓扑与地址规划
骨干网位于 AS 65000,由 AR1(PE)、AR2(P)、AR3(PE) 以及路由反射器 AR8(RR,10.0.0.10) 组成,底层运行 OSPF Area 0 与 MPLS LDP。客户端划分为两个彼此隔离的业务实例:VRF green(AS 65001,RD/RT 65001:100) 和 VRF red(AS 65002,RD/RT 65002:100)。
一、Underlay 检查:验证 OSPF 邻接与 MPLS LDP 标签分发
首先在 VPNv4 Domain 内完成物理接口 IP、Loopback、OSPF Area 0 与 MPLS LDP 基础配置。配置完成后,在核心 P 路由器 AR2 上核查 OSPF 邻居、LDP 会话及 LDP LSP 转发表状态:
<AR2-P>display ospf peer brief OSPF Process 1 with Router ID 10.0.0.2 Peer Statistic Information ---------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.0 GigabitEthernet4/0/1 10.0.0.3 Full 0.0.0.0 GigabitEthernet4/0/2 10.0.0.1 Full 0.0.0.0 GigabitEthernet4/0/3 10.0.0.10 Full ----------------------------------------------------------------------------
<AR2-P>dis mpls ldp session LDP Session(s) in Public Network Codes: LAM(Label Advertisement Mode), SsnAge Unit(DDDD:HH:MM) A '*' before a session means the session is being deleted. ------------------------------------------------------------------------------ PeerID Status LAM SsnRole SsnAge KASent/Rcv ------------------------------------------------------------------------------ 10.0.0.1:0 Operational DU Active 0000:00:03 14/14 10.0.0.3:0 Operational DU Passive 0000:00:03 14/14 10.0.0.10:0 Operational DU Passive 0000:00:03 14/14 ------------------------------------------------------------------------------ TOTAL: 3 session(s) Found.
<AR2-P>display mpls lsp
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
10.0.0.3/32 NULL/3 -/GE4/0/1
10.0.0.3/32 1024/3 -/GE4/0/1
10.0.0.2/32 3/NULL -/-
10.0.0.1/32 NULL/3 -/GE4/0/2
10.0.0.1/32 1025/3 -/GE4/0/2
10.0.0.10/32 NULL/3 -/GE4/0/3
10.0.0.10/32 1026/3 -/GE4/0/3
经检查,骨干网的 OSPF 和 MPLS LDP 均已正常建立邻居并成功分发外层传输标签。下一步我们配置骨干网的 MP-BGP 协议。
二、配置路由反射器 AR8 与关键避坑要点
在骨干网内使用 AR8(Loopback 10.0.0.10)作为路由反射器(RR),分别与两台 PE(10.0.0.1 和 10.0.0.3)建立 iBGP IPv4 及 VPNv4 邻居关系:
[AR8-RR-bgp]dis this [V200R003C00] # bgp 65000 undo default ipv4-unicast peer 10.0.0.1 as-number 65000 peer 10.0.0.1 connect-interface LoopBack0 peer 10.0.0.3 as-number 65000 peer 10.0.0.3 connect-interface LoopBack0 # ipv4-family unicast undo synchronization peer 10.0.0.1 enable peer 10.0.0.1 reflect-client peer 10.0.0.1 advertise-community peer 10.0.0.3 enable peer 10.0.0.3 reflect-client peer 10.0.0.3 advertise-community # ipv4-family vpnv4 undo policy vpn-target peer 10.0.0.1 enable peer 10.0.0.1 reflect-client peer 10.0.0.1 advertise-community peer 10.0.0.3 enable peer 10.0.0.3 reflect-client peer 10.0.0.3 advertise-community
华为 VRP 两个关键配置注意事项:
- 必须配置
advertise-community,否则携带 Route Target 的inet-vpnv4扩展团体属性不会发送给 RR Client,导致对端 PE 无法导入路由; - 华为路由器充当 VPNv4 路由反射器时,由于本机通常未创建对应的业务 VPN 实例,必须在
ipv4-family vpnv4视图下执行undo policy vpn-target关闭 RT 过滤,否则 RR 会直接丢弃收到的 VPNv4 路由。
三、配置 PE 设备(AR1 / AR3)的 VRF 实例与 substitute-as
接下来在两台 PE(AR1 和 AR3)上分别创建 green 与 red 两个 ip vpn-instance,将连接 CE 的接口绑定到对应 VRF,并在 PE-CE eBGP 邻居中配置 substitute-as:
<AR1-PE>dis current-configuration [V200R003C00] # ip vpn-instance green ipv4-family route-distinguisher 65001:100 vpn-target 65001:100 export-extcommunity vpn-target 65001:100 import-extcommunity # ip vpn-instance red ipv4-family route-distinguisher 65002:100 vpn-target 65002:100 export-extcommunity vpn-target 65002:100 import-extcommunity # interface GigabitEthernet4/0/0 ip binding vpn-instance green ip address 10.1.0.1 255.255.255.0 # interface GigabitEthernet4/0/2 ip binding vpn-instance red ip address 10.2.0.1 255.255.255.0 # bgp 65000 undo default ipv4-unicast peer 10.0.0.10 as-number 65000 peer 10.0.0.10 connect-interface LoopBack0 # ipv4-family unicast undo synchronization peer 10.0.0.10 enable peer 10.0.0.10 advertise-community # ipv4-family vpnv4 policy vpn-target peer 10.0.0.10 enable peer 10.0.0.10 advertise-community # ipv4-family vpn-instance green peer 10.1.0.2 as-number 65001 peer 10.1.0.2 substitute-as # ipv4-family vpn-instance red peer 10.2.0.2 as-number 65002 peer 10.2.0.2 substitute-as
这里配置 substitute-as 的目的是将路由路径中属于对端客户站点的原始 AS 号替换为运营商自己的 AS 号(65000),防止同客户两端站点使用相同 ASN(如同为 AS 65001)时因 BGP AS_PATH 防环机制而拒收对端路由。其作用等同于 Cisco IOS/IOS-XE 中的 as-override。
<AR3-PE>dis current-configuration [V200R003C00] # ip vpn-instance green ipv4-family route-distinguisher 65001:100 vpn-target 65001:100 export-extcommunity vpn-target 65001:100 import-extcommunity # ip vpn-instance red ipv4-family route-distinguisher 65002:100 vpn-target 65002:100 export-extcommunity vpn-target 65002:100 import-extcommunity # interface GigabitEthernet4/0/0 ip binding vpn-instance red ip address 10.3.0.1 255.255.255.0 # interface GigabitEthernet4/0/2 ip binding vpn-instance green ip address 10.4.0.1 255.255.255.0 # bgp 65000 undo default ipv4-unicast peer 10.0.0.10 as-number 65000 peer 10.0.0.10 connect-interface LoopBack0 # ipv4-family unicast undo synchronization peer 10.0.0.10 enable peer 10.0.0.10 advertise-community # ipv4-family vpnv4 policy vpn-target peer 10.0.0.10 enable peer 10.0.0.10 advertise-community # ipv4-family vpn-instance green peer 10.4.0.2 as-number 65001 peer 10.4.0.2 substitute-as # ipv4-family vpn-instance red peer 10.3.0.2 as-number 65002 peer 10.3.0.2 substitute-as
最后在两端 CE(AR4、AR5、AR6、AR7)上配置好对应接口 IP 与 eBGP 邻居并宣告各自下游业务网段,整体架构即部署完毕。
四、控制面与数据面隔离验证
首先在 CE 侧查看 AR4(VRF Green) 与 AR5(VRF Red) 的 BGP 路由表,可以看到两端均仅学习到同属一个 VRF 的远端路由,且 AS_PATH 已被 PE 成功替换为 65000 65000 i:
<AR4-VRF-Green>dis bgp routing-table
BGP Local router ID is 10.1.0.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.0.0 0.0.0.0 0 0 i
*> 192.168.3.0 10.1.0.1 0 65000 65000i
<AR5-VRF-Red>dis bgp routing-table
BGP Local router ID is 192.168.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.1.0 0.0.0.0 0 0 i
*> 192.168.2.0 10.2.0.1 0 65000 65000i
路由控制面已实现严格隔离,下面分别从 PC1(VRF Green) 与 PC2(VRF Red) 发起同实例与跨实例 ping 测试,验证数据面转发行为:
PC1-VRF-Green>ping 192.168.3.2 Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break Request timeout! <== 首包触发 ARP 解析超时 From 192.168.3.2: bytes=32 seq=2 ttl=123 time=32 ms From 192.168.3.2: bytes=32 seq=3 ttl=123 time=47 ms From 192.168.3.2: bytes=32 seq=4 ttl=123 time=31 ms From 192.168.3.2: bytes=32 seq=5 ttl=123 time=31 ms --- 192.168.3.2 ping statistics --- 5 packet(s) transmitted 4 packet(s) received 20.00% packet loss round-trip min/avg/max = 0/35/47 ms PC1-VRF-Green>ping 192.168.2.2 Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break Request timeout! Request timeout! Request timeout! Request timeout! Request timeout! --- 192.168.2.2 ping statistics --- 5 packet(s) transmitted 0 packet(s) received 100.00% packet loss
PC2-VRF-Red>ping 192.168.2.2 Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break Request timeout! From 192.168.2.2: bytes=32 seq=2 ttl=123 time=31 ms From 192.168.2.2: bytes=32 seq=3 ttl=123 time=31 ms From 192.168.2.2: bytes=32 seq=4 ttl=123 time=47 ms From 192.168.2.2: bytes=32 seq=5 ttl=123 time=31 ms --- 192.168.2.2 ping statistics --- 5 packet(s) transmitted 4 packet(s) received 20.00% packet loss round-trip min/avg/max = 0/35/47 ms PC2-VRF-Red>ping 192.168.3.2 Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break Request timeout! Request timeout! Request timeout! Request timeout! Request timeout! --- 192.168.3.2 ping statistics --- 5 packet(s) transmitted 0 packet(s) received 100.00% packet loss
同色 VRF 互通正常且跨 VRF 完全隔离,基于华为 AR2240 的 MPLS L3VPN 实验顺利完成。
经验总结
- 华为 VRP 在 MPLS L3VPN 整体逻辑上与 Cisco IOS/IOS-XE 高度一致,但在路由反射器(
undo policy vpn-target+advertise-community)与 PE-CE 防环(substitute-as)等关键字上具有厂商自身实现细节,部署时需重点核对; - 熟悉 Cisco CLI 的工程师迁移至华为平台时,把握好各协议视图与关键词映射即可快速上手。