素材来源:华为路由器配置指南
一边学习一边整理试验笔记,并与大家分享,侵权即删,谢谢支持!
附上汇总贴:玩转华为ENSP模拟器系列 | 合集_COCOgsta的博客-CSDN博客_ensp实验大全
目标
配置基于eBGP的PE和接入侧设备间的路由交换
组网模型

配置思路
- 配置使能EVPN的基于IPv4的L3VPN实例。
- 配置静态路由使两台PE的Loopback地址互通。
- 创建一个BGP实例。
- 配置iBGP对等体。
- 配置基于IPv4的BGP-VPN。
- 使能BGP的EVPN地址族。
- 使能PE设备的MPLS LDP协议。
- 配置CE和PE之间的BGP路由交换。
操作步骤
- PE1节点配置
配置使能EVPN的基于IPv4的L3VPN实例
PE1:
ip vpn-instance testipv4-familyroute-distinguisher 100:1apply-label per-instancevpn-target 100:1 export-extcommunity evpnvpn-target 100:1 import-extcommunity evpnevpn mpls routing-enable
interface Ethernet1/0/0.1vlan-type dot1q 1ip binding vpn-instance testip address 10.0.0.1 255.255.255.0
配置静态路由使两台PE的Loopback地址互通
PE1:
interface LoopBack1ip address 1.1.1.134 255.255.255.255
interface Ethernet1/0/1ip address 100.0.0.1 255.255.255.0
ip route-static 1.1.1.135 255.255.255.255 100.0.0.2
创建一个BGP实例
PE1:
bgp 65000
配置iBGP对等体
PE1:
bgp 65000peer 1.1.1.135 as-number 65000peer 1.1.1.135 connect-interface LoopBack1
配置基于IPv4的BGP-VPN
PE1:
bgp 65000ipv4-family vpn-instance testimport-route directadvertise l2vpn evpn
使能BGP的EVPN地址族
PE1:
bgp 65000l2vpn-family evpnpeer 1.1.1.135 enable
使能设备的MPLS LDP
PE1:
mpls lsr-id 1.1.1.134
mpls
mpls ldp
interface Ethernet1/0/1mplsmpls ldp
配置CE与PE之间的eBGP路由交换
PE1:
bgp 65000ipv4-family vpn-instance testpeer 10.0.0.2 as-number 100
- PE2节点配置
配置使能EVPN的基于IPv4的L3VPN实例
PE2:
ip vpn-instance testipv4-familyroute-distinguisher 100:1apply-label per-instancevpn-target 100:1 export-extcommunity evpnvpn-target 100:1 import-extcommunity evpnevpn mpls routing-enable
interface Ethernet1/0/1.1vlan-type dot1q 1ip binding vpn-instance testip address 20.0.0.1 255.255.255.0
配置静态路由使两台PE的Loopback地址互通
PE2:
interface LoopBack1ip address 1.1.1.135 255.255.255.255
interface Ethernet1/0/0ip address 100.0.0.2 255.255.255.0
ip route-static 1.1.1.134 255.255.255.255 100.0.0.1
创建一个BGP实例
PE2:
bgp 65000
配置iBGP对等体
PE2:
bgp 65000peer 1.1.1.134 as-number 65000peer 1.1.1.134 connect-interface LoopBack1
配置基于IPv4的BGP-VPN
PE2:
bgp 65000ipv4-family vpn-instance testimport-route directadvertise l2vpn evpn
使能BGP的EVPN地址族
PE2:
bgp 65000l2vpn-family evpnpeer 1.1.1.134 enable
使能设备的MPLS LDP
PE2:
mpls lsr-id 1.1.1.135
mpls
mpls ldp
interface Ethernet1/0/0mplsmpls ldp
配置CE与PE之间的eBGP路由交换
PE2:
bgp 65000ipv4-family vpn-instance testimport-route directadvertise l2vpn evpnpeer 20.0.0.2 as-number 100
- 配置节点CE1
配置eBGP邻居
CE1:
interface Ethernet1/0/0.1vlan-type dot1q 1ip address 10.0.0.2 255.255.255.0
bgp 100peer 10.0.0.1 as-number 65000
创建Loopback10,将其路路由通告至BGP中
CE1:
interface LoopBack10ip address 30.1.1.1 255.255.255.255
bgp 100ipv4-family unicastnetwork 30.1.1.1 255.255.255.255
- 配置节点CE2
配置eBGP邻居
CE2:
interface Ethernet1/0/0.1vlan-type dot1q 1ip address 20.0.0.2 255.255.255.0
bgp 100peer 20.0.0.1 as-number 65000
创建Loopback10,将其路路由通告至BGP中
CE2:
interface LoopBack10ip address 40.1.1.1 255.255.255.255
bgp 100ipv4-family unicastnetwork 40.1.1.1 255.255.255.255
- 配置验证
查看PE1的L3VPN实例的路由表
[~PE1]dis ip routing-table vpn-instance test
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black holeroute
------------------------------------------------------------------------------
Routing Table : testDestinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface10.0.0.0/24 Direct 0 0 D 10.0.0.1 Ethernet1/0/0
.110.0.0.1/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/0
.110.0.0.255/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/0
.120.0.0.0/24 IBGP 255 0 RD 1.1.1.135 Ethernet1/0/130.1.1.1/32 EBGP 255 0 RD 10.0.0.2 Ethernet1/0/0
.140.1.1.1/32 IBGP 255 0 RD 1.1.1.135 Ethernet1/0/1127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[~PE1]
查看PE1的EVPN前缀路由表
[~PE1]dis bgp evpn all routing-table prefix-route Local AS number : 65000BGP Local router ID is 1.1.1.134Status codes: * - valid, > - best, d - damped, x - best external, a - add path,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteEVPN address family:Number of Ip Prefix Routes: 4Route Distinguisher: 100:1Network(EthTagId/IpPrefix/IpPrefixLen) NextHop*> 0:10.0.0.0:24 0.0.0.0*>i 0:20.0.0.0:24 1.1.1.135*> 0:30.1.1.1:32 0.0.0.0*>i 0:40.1.1.1:32 1.1.1.135EVPN-Instance __RD_1_100_1__:Number of Ip Prefix Routes: 4Network(EthTagId/IpPrefix/IpPrefixLen) NextHop*> 0:10.0.0.0:24 0.0.0.0*>i 0:20.0.0.0:24 1.1.1.135*> 0:30.1.1.1:32 0.0.0.0*>i 0:40.1.1.1:32 1.1.1.135
[~PE1]
查看PE2的L3VPN实例的路由表
[~PE2-bgp]dis ip routing-table vpn-instance test
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black holeroute
------------------------------------------------------------------------------
Routing Table : testDestinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface10.0.0.0/24 IBGP 255 0 RD 1.1.1.134 Ethernet1/0/020.0.0.0/24 Direct 0 0 D 20.0.0.1 Ethernet1/0/1
.120.0.0.1/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/1
.120.0.0.255/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/1
.130.1.1.1/32 IBGP 255 0 RD 1.1.1.134 Ethernet1/0/040.1.1.1/32 EBGP 255 0 RD 20.0.0.2 Ethernet1/0/1
.1127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[~PE2-bgp]
查看PE2的EVPN前缀路由表
[~PE2-bgp] dis bgp evpn all routing-table prefix-route Local AS number : 65000BGP Local router ID is 1.1.1.135Status codes: * - valid, > - best, d - damped, x - best external, a - add path,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteEVPN address family:Number of Ip Prefix Routes: 4Route Distinguisher: 100:1Network(EthTagId/IpPrefix/IpPrefixLen) NextHop*>i 0:10.0.0.0:24 1.1.1.134*> 0:20.0.0.0:24 0.0.0.0*>i 0:30.1.1.1:32 1.1.1.134*> 0:40.1.1.1:32 0.0.0.0EVPN-Instance __RD_1_100_1__:Number of Ip Prefix Routes: 4Network(EthTagId/IpPrefix/IpPrefixLen) NextHop*>i 0:10.0.0.0:24 1.1.1.134*> 0:20.0.0.0:24 0.0.0.0*>i 0:30.1.1.1:32 1.1.1.134*> 0:40.1.1.1:32 0.0.0.0
[~PE2-bgp]