EVPN 三层通信实验

一、 预习:

EVPN Type 5 Prefix 路由:

三层路由不仅可以由 BGP MPLS V 标传送,也可以用 BGP EVPN E标 传送,区别是:

用 BGP V 标传送的过程:CE1 把 IP 路由 传给 PE1,PE1 会自动把它变为 VPN-Instance 路由,进入到 VPNv4 路由表中,携带 RD、RT 值传递给对端 PE2,对端 PE 2 会根据 RT 值将它导入相应的 VPN-Instance 路由表中,传递给 CE2。整个过程中,路由的交叉是自动完成的。

但 BGP EVPN 传递的 EVPN Type 5 prefix 路由的路由交叉需要手动完成:advertise l2vpn evpn

并且,E标 的产生也需要手工开启能力:evpn mpls routing-enable

Type 5 prefix route:用于在网络中传播从 CE 侧网络收到的 IP 地址信息或者主机 IP 所在的网段信息:Type 5 路由的 NLRI 格式内容中包括:

RD(8 Bytes)

ESI(10 Bytes)

Ethernet Tag ID(4 Byte)

IP Prefix Length(1 Bytes)

IP Prefix(4 或者 16 Bytes)

GW IP Address(4 或者 16 Bytes)

MPLS Label(3 Bytes)

二、拓扑:

三、配置过程:

1、创建三层实例

ip vpn-instance 1

route-distinguisher 100:1

vpn-target 100:1 evpn #声明RT类型,需要加上 evpn 才是 EVPN 携带的 RT,否则,默认是为 VPNv4 携带的 RT

evpn mpls routing-enable #EVPN中的隧道可以不用 MPLS,if 隧道用 MPLS,就需要手工产生标签

2、进入 BGP,在实例中发布路由:

bgp 100

ipv4-family vpn-instance 1

network 100.1.1.1 255.255.255.255 #先把三层实例路由发布到实例路由地址族中,再交叉到 EVPN 中

dis bgp vpnv4 all routing-table #现在可以看到实例路由已经自动生成,但是不会自动变成 EVPN Type 5 prefix-route

dis bgp evpn all routing-table prefix-route #查看一下 Type 5 路由,看到没有,so,手动让它生成和宣告:

advertise l2vpn evpn #手动交叉到 EVPN 路由表中,这时再查看 Type 5路由,就看到有了

3、在 PE 上配置对 CE 端接口的 ESI 号

三、验证和查看表项:

1、先来个跟踪:

2、在 PE1 右边抓个包可以看到两层标签,内层是 EVPN 为实例路由分配的48013,外层是 ISP 内部分配的 IGP 标签:

3、看一下标签:

4、看一下我们一直期待的 EVPN Type 5 prefix 路由:


5、抓包看一下 Type 5 路由,可以看到不但有IP地址、长度、还有网关、RD、标签:

四、详细配置:

R1(CE1):

复制代码
interface GigabitEthernet0/0/0
 ip address 11.1.1.1 255.255.255.0 
#
interface LoopBack0
 ip address 100.1.1.1 255.255.255.255 
#
ospf 1 router-id 5.5.5.5 
 area 0.0.0.0 
  network 11.1.1.0 0.0.0.255 
  network 100.1.1.1 0.0.0.0 
#

NE1(PE1):

复制代码
ip vpn-instance 1
ipv4-family
  route-distinguisher 100:1
  vpn-target 100:1 export-extcommunity evpn
  vpn-target 200:1 import-extcommunity evpn
  vpn-target 100:1 import-extcommunity evpn
  evpn mpls routing-enable
#
mpls lsr-id 1.1.1.1
mpls
mpls ldp
 #
 ipv4-family
#
interface Ethernet1/0/0
 undo shutdown
 ip binding vpn-instance 1
 ip address 11.1.1.2 255.255.255.0
 esi 0000.1111.1111.1111.1111
 undo dcn
 undo dcn mode vlan
#
interface Ethernet1/0/1
 undo shutdown
 ip address 13.1.1.1 255.255.255.0
 mpls
 mpls ldp
 undo dcn
 undo dcn mode vlan
#
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255
#
bgp 100
 router-id 1.1.1.1
 undo default ipv4-unicast
 peer 2.2.2.2 as-number 100
 peer 2.2.2.2 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  undo peer 2.2.2.2 enable
 #
 ipv4-family vpn-instance 1
  import-route ospf 2
  advertise l2vpn evpn
 #
 l2vpn-family evpn
  undo policy vpn-target
  peer 2.2.2.2 enable
#
ospf 1 router-id 1.1.1.1
 area 0.0.0.0
  network 1.1.1.1 0.0.0.0
  network 13.1.1.0 0.0.0.255
#
ospf 2 router-id 6.6.6.6 vpn-instance 1
 import-route bgp
 area 0.0.0.0
  network 11.1.1.0 0.0.0.255
#
undo dcn
#
evpn source-address 1.1.1.1

R3(P):

复制代码
mpls lsr-id 3.3.3.3
mpls
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 13.1.1.3 255.255.255.0 
mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 23.1.1.3 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 3.3.3.3 255.255.255.255 
#	
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 3.3.3.3 0.0.0.0 
  network 13.1.1.0 0.0.0.255 
  network 23.1.1.0 0.0.0.255 
#

NE2(PE2):

复制代码
ip vpn-instance 1
 ipv4-family
  route-distinguisher 200:1
  vpn-target 200:1 export-extcommunity evpn
  vpn-target 100:1 import-extcommunity evpn
  vpn-target 200:1 import-extcommunity evpn
  evpn mpls routing-enable
#	
mpls lsr-id 2.2.2.2
mpls
mpls ldp
 #
 ipv4-family
#
interface Ethernet1/0/0
 undo shutdown
 ip address 23.1.1.2 255.255.255.0
 mpls
 mpls ldp
 undo dcn
 undo dcn mode vlan
#
interface Ethernet1/0/1
 undo shutdown
 ip binding vpn-instance 1
 ip address 22.1.1.1 255.255.255.0
 esi 0000.2222.2222.2222.2222
 undo dcn
 undo dcn mode vlan
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255
#
bgp 100
 router-id 2.2.2.2
 undo default ipv4-unicast
 peer 1.1.1.1 as-number 100
 peer 1.1.1.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  undo peer 1.1.1.1 enable
 #
 ipv4-family vpn-instance 1
  import-route ospf 2
  advertise l2vpn evpn
 #
 l2vpn-family evpn
  undo policy vpn-target
  peer 1.1.1.1 enable
#
ospf 1 router-id 2.2.2.2
 area 0.0.0.0
  network 2.2.2.2 0.0.0.0
  network 23.1.1.0 0.0.0.255
#
ospf 2 router-id 3.3.3.3 vpn-instance 1
 import-route bgp
 area 0.0.0.0
  network 22.1.1.0 0.0.0.255
#
undo dcn
#
evpn source-address 2.2.2.2

R2(CE2):

复制代码
interface GigabitEthernet0/0/0
 ip address 22.1.1.2 255.255.255.0 
#
interface LoopBack0
 ip address 200.1.1.1 255.255.255.255 
#
ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 22.1.1.0 0.0.0.255 
  network 200.1.1.1 0.0.0.0 
#

五、附 EVPN 5种路由的图表:


相关推荐
聆风吟º1 天前
CANN开源项目实战指南:使用oam-tools构建自动化故障诊断与运维可观测性体系
运维·开源·自动化·cann
那就回到过去1 天前
VRRP协议
网络·华为·智能路由器·ensp·vrrp协议·网络hcip
NPE~1 天前
自动化工具Drissonpage 保姆级教程(含xpath语法)
运维·后端·爬虫·自动化·网络爬虫·xpath·浏览器自动化
极客小云1 天前
【ComfyUI API 自动化利器:comfyui_xy Python 库使用详解】
网络·python·自动化·comfyui
神梦流1 天前
GE 引擎的内存优化终局:静态生命周期分析指导下的内存分配与复用策略
linux·运维·服务器
符哥20081 天前
用Apollo + RxSwift + RxCocoa搭建一套网络请求框架
网络·ios·rxswift
相思难忘成疾1 天前
通向HCIP之路:第四步:边界网关路由协议—BGP(概念、配置、特点、常见问题及其解决方案)
网络·华为·hcip
Lsir10110_1 天前
【Linux】进程信号(下半)
linux·运维·服务器
君陌社区·网络安全防护中心1 天前
基于Mininet模拟SDN环境
网络
Porco.w1 天前
C#与三菱PLC FX5U通信
网络·c#