HCIE-路由交换专题实验-EVPN配置 L2&L3 单归&多归实验

HCIE-路由交换专题实验-EVPN L2&L3 单归&多归实验

1 L2 单归

1.1 实验介绍

1.1.1 实验拓扑

由于是L2 VPN, 所以这里CE设备使用的是两台交换机

image-20231030101244461

1.1.2 实验说明

两个ES中的CE为同网段但不同物理地址的设备, 骨干网中配置BGP

1.1.3 实验需求

配置EVPN L2单归场景, 使得同网段的两端CE设备实现互访

1.2 配置流程

  1. 两端CE创建VLANIF, 并在PE和CE设备上配置lacp链路聚合并配置trunk放行vlan(注: NE40E设备默认开启DCN, 开启DCN会导致接口上存在网元地址, 此时无法将存在网元地址的接口加入聚合口)

  2. 骨干网打通LDP, 起BGP和ISIS, NE2作为RR反射器

  3. 在bgp中进入l2vpn-famliy evpn中建立邻居关系并开启RT检查

  4. 两端PE创建evpn vpn-instance 记得加上bd-mode, 然后配置RD和RT

  5. 采用VLAN Based方式, PE创建BD域(虚拟广播域, 到VXLAN时会详细介绍)并绑定EVPN实例

    bridge-domain 10
    	evpn bingding vpn-instance site1
    
  6. 将BD域绑定接口(这个接口只能是子接口)

  7. 指定EVPN源地址

在单归场景下配置链路聚合的原因其实是防止模拟器的bug影响实验, 不配置链路聚合有可能导致EVPN实验失败

1.3 配置脚本

PE1

sy im
sys PE1
undo dcn
y

mpls lsr-id 1.1.1.1
mpls ldp
	qu

isis 1
	network-entity 47.0001.0000.0000.0001.00
	is-level level-2
	cost-style wide
	qu

int eth-trunk 1
	trunkport ethe1/0/0
	mode lacp-static
	qu
int ethe1/0/1
	ip add 10.0.12.1 24
	isis enable 1
	mpls 
	mpls ldp	
	qu
int loop0
	ip add 1.1.1.1 32
	isis enable 1
	qu

evpn vpn-instance ES1 bd-mode	#以BD域的方式创建EVPN实例
	route-distinguisher 100:1
	vpn-target 100:1 export-extcommunity
	vpn-target 200:1 import-extcommunity
	qu

bgp 100
	peer 2.2.2.2 as-number 100
	peer 2.2.2.2 connect-int loop0
	l2vpn-family evpn
		peer 2.2.2.2 enable
		y
		policy vpn-target	#RT检查在l2vpn簇里默认未开启
		qu
	qu
	
bridge-domain 10
	evpn binding vpn-instance ES1
	qu


int eth-trunk1.10 mode l2
	encapsulation dot1q vid 10
	rewrite pop single
	bridge-domain 10
	qu

evpn source-address 1.1.1.1

PE2

sy im
sys PE2
undo dcn
y
mpls lsr-id 3.3.3.3
mpls 
	mpls ldp
	qu
isis 1
	network-entity 47.0001.0000.0000.0003.00
	is-level level-2
	cost-style wide
	qu

int eth-trunk 1
	trunkport ethe1/0/0
	mode lacp-static
	qu
int ethe1/0/1
	ip add 10.0.23.3 24
	isis enable 1
	mpls 
	mpls ldp	
	qu
int loop0
	ip add 3.3.3.3 32
	isis enable 1
	qu

evpn vpn-instance ES2 bd-mode
	route-distinguisher 200:1
		vpn-target 200:1 export-extcommunity
		vpn-target 100:1 import-extcommunity
		qu
	qu


bgp 100
	peer 2.2.2.2 as-number 100
	peer 2.2.2.2 connect-int loop0
	l2vpn-family evpn
		peer 2.2.2.2 enable
		y
		policy vpn-target
		qu
	qu
	
bridge-domain 10
	evpn binding vpn-instance ES2
	qu

int eth-trunk1.10 mode l2
	encapsulation dot1q vid 10
	rewrite pop single
	bridge-domain 10
	qu

evpn source-address 3.3.3.3

P1

sy im
sys P1
undo dcn
y
mpls lsr-id 2.2.2.2
mpls 
	mpls ldp
	qu
isis 1
	network-entity 47.0001.0000.0000.0002.00
	is-level level-2
	cost-style wide
	qu

int ethe1/0/0
	ip add 10.0.12.2 24
	isis enable 1
	mpls 
	mpls ldp	
	qu
int ethe1/0/1
	ip add 10.0.23.2 24
	isis enable 1
	mpls 
	mpls ldp
	qu
int loop0
	ip add 2.2.2.2 32
	isis enable 1
	qu

bgp 100
	peer 1.1.1.1 as-number 100
	peer 1.1.1.1 connect-int loop0
	peer 3.3.3.3 as-number 100
	peer 3.3.3.3 connect-int loop0
	l2vpn-family evpn
		peer 1.1.1.1 enable
		y
		peer 3.3.3.3 enable
		y
		peer 1.1.1.1 reflect-client
		peer 3.3.3.3 reflect-client
		qu
	qu

CE1

sy 
sys CE1
vlan batch 10
int vlan 10
	ip add 10.1.1.1 24
	qu
int eth-trunk 1
	mode lacp-static
	trunkport g0/0/1
	port link-type trunk
	port trunk allow-pass vlan 10
	qu

CE2

sy 
sys CE2
vlan batch 10
int vlan 10
	ip add 10.1.1.2 24
	qu
int eth-trunk 1
	mode lacp-static
	trunkport g0/0/1
	port link-type trunk
	port trunk allow-pass vlan 10

检查bgp邻居关系

dis bgp evpn peer

image-20231030101219148

在PE上查看通过LACP自动生成的ESI

dis bgp evpn all esi

image-20231031101701698

image-20231031101716638

此时CE1和CE2可以互相ping通

image-20231031104949969

2 L2多归

2.1 实验介绍

2.1.1 实验拓扑

image-20231102131621464

2.1.2 实验说明

两个ES中的CE为同网段但不同物理地址的设备, 骨干网中配置BGP, CE1双活接入PE1与PE2

2.1.3 实验需求

CE1双活接入PE1与PE2, 指定PE1为DF, 使CE1与CE2之间相互通信

2.2 配置流程

  1. 依照规划配置ip地址, 骨干网起isis和BGP, P1做RR与其他PE建立L2VPN邻居.
  2. 骨干网起MPLS, 以LDP的形式建立LSP
  3. PE创建VPN实例和BD域, 并完成接口-BD域-VPN实例的绑定, 指定EVPN源地址
  4. CE和PE直接起链路聚合, 做VLAN Based模式, PE1做跨设备链路聚合, 并配置优先级指定主控端

要点: 相较于单归场景, 多归场景下额外需要配置的是跨设备链路聚合, 需要在PE1和PE2上指定lacp的system-id和priority保持一致, 同时相互建立邻居关系

2.3 配置脚本

PE1

sy im
sys PE1
undo dcn
y
mpls lsr-id 1.1.1.1
mpls 
	mpls ldp
	qu
isis 1
	network-entity 49.0001.0000.0000.0001.00
	is-level level-2
	cost-style wide
	qu
int ethe1/0/1
	ip add 10.0.13.1 24
	isis enable
	mpls
	mpls ldp
	qu
int loopback0
	ip add 1.1.1.1 32
	isis enable
	qu
int eth-trunk 1
	mode lacp-static
	trunkport ethe 1/0/0
	qu
	
evpn vpn-instance ES1 bd-mode
	route-distinguisher 100:1
	vpn-target 1:1 both
	qu
bridge-domain 10
	evpn binding vpn-instance ES1
	qu
int eth-trunk1.10 mode l2
	encapsulation dot1q vid 10
	rewrite pop single
	bridge-domain 10
	qu
evpn source-address 1.1.1.1
	
bgp 100
	router-id 1.1.1.1
	undo default ipv4-unicast	#关闭默认地址簇
	peer 3.3.3.3 as-number 100
	peer 3.3.3.3 connect-int loop0
	ipv4-family unicast
		undo synchronization
		undo peer 3.3.3.3 enable
		qu
	l2vpn-family evpn
		peer 3.3.3.3 enable
		y
		policy vpn-target
		qu

lacp e-trunk system-id 00e0-5e00-0000	#跨设备链路聚合的设备需要相同的系统id和优先级
lacp priority 10	#配置跨设备链路聚合优先级
e-trunk 1	
	peer-address 2.2.2.2 source-address 1.1.1.1	#配置跨设备链路聚合的邻居
	qu
int eth-trunk 1
	e-trunk 1	#聚合口绑定跨设备链路聚合口
	e-trunk mode force-master	#指定当前设备为跨设备链路聚合的主设备
	qu

PE2

sy im
sys PE2
undo dcn
y
mpls lsr-id 2.2.2.2
mpls 
	mpls ldp
	qu
isis 1
	network-entity 49.0001.0000.0000.0002.00
	is-level level-2
	cost-style wide
	qu
int ethe1/0/1
	ip add 10.0.23.2 24
	isis enable
	mpls
	mpls ldp
	qu
int loopback0
	ip add 2.2.2.2 32
	isis enable
	qu
int eth-trunk 1
	mode lacp-static
	trunkport ethe 1/0/0
	qu
	
evpn vpn-instance ES1 bd-mode
	route-distinguisher 100:2
	vpn-target 1:1 both
	qu
bridge-domain 10
	evpn binding vpn-instance ES1
	qu
int eth-trunk1.10 mode l2
	encapsulation dot1q vid 10
	rewrite pop single
	bridge-domain 10
	qu
evpn source-address 2.2.2.2

bgp 100
	router-id 2.2.2.2
	undo default ipv4-unicast
	peer 3.3.3.3 as-number 100
	peer 3.3.3.3 connect-int loop0
	ipv4-family unicast
		undo synchronization
		undo peer 3.3.3.3 enable
		qu
	l2vpn-family evpn
		peer 3.3.3.3 enable
		y
		policy vpn-target
		qu
	qu

lacp e-trunk system-id 00e0-5e00-0000
lacp priority 10
e-trunk 1
	peer-address 1.1.1.1 source-address 2.2.2.2
	qu
int eth-trunk 1
	e-trunk 1
	e-trunk mode force-master	#做双活来绕开ENSP的协商bug
	qu

P1

sy im
sys P1
undo dcn
y
mpls lsr-id 3.3.3.3
mpls 
	mpls ldp
	qu
isis 1
	network-entity 49.0001.0000.0000.0003.00
	is-level level-2
	cost-style wide
	qu
int ethe1/0/1
	ip add 10.0.13.3 24
	isis enable
	mpls
	mpls ldp
	qu
int ethe1/0/2
	ip add 10.0.23.3 24
	isis enable
	mpls
	mpls ldp
	qu
int ethe1/0/3
	ip add 10.0.34.3 24
	isis enable
	mpls
	mpls ldp
	qu
int loopback0
	ip add 3.3.3.3 32
	isis enable
	qu

bgp 100
	router-id 3.3.3.3
	undo default ipv4-unicast
	peer 1.1.1.1 as-number 100
	peer 1.1.1.1 connect-int loop0
	peer 2.2.2.2 as-number 100
	peer 2.2.2.2 connect-int loop0
	peer 4, as-number 100
	peer 3.3.3.3 connect-int loop0
	l2vpn-family evpn
		peer 1.1.1.1 enable
		y
		peer 2.2.2.2 enable
		y
		peer 4.4.4.4 enable
		y
		policy vpn-target
		peer 1.1.1.1 reflect-client
		peer 2.2.2.2 reflect-client
		peer 4.4.4.4 reflect-client
		qu
	qu

PE3

sy im	
sys PE3
undo dcn
y
mpls lsr-id 4.4.4.4
mpls 
	mpls ldp
	qu
isis 1
	network-entity 49.0001.0000.0000.0004.00
	is-level level-2
	cost-style wide
	qu
int ethe1/0/3
	ip add 10.0.34.4 24
	isis enable
	mpls
	mpls ldp
	qu
int loopback0
	ip add 4.4.4.4 32
	isis enable
	qu
int eth-trunk 1
	mode lacp-static
	trunkport ethe1/0/0
	qu
	
bgp 100
	router-id 4.4.4.4
	undo default ipv4-unicast
	peer 3.3.3.3 as-number 100
	peer 3.3.3.3 connect-int loop0
	ipv4-family unicast
		undo synchronization
		undo peer 3.3.3.3 enable
		qu
	l2vpn-family evpn
		peer 3.3.3.3 enable
		y
		policy vpn-target
		qu
	qu

evpn vpn-instance ES2 bd-mode
	route-distinguisher 200:1
	vpn-target 1:1 both
	qu
bridge-domain 10
	evpn binding vpn-instance ES2
	qu
int eth-trunk1.10 mode l2
	encapsulation dot1q vid 10
	rewrite pop single
	bridge-domain 10
	qu
evpn source-address 4.4.4.4

CE1

sy
sys CE1

vlan batch 10
int vlan 10
	ip add 10.1.1.1 24
	qu

int eth-trunk 1
	mode lacp-static	
	trunkport g0/0/1
	trunkport g0/0/2
	port link-type trunk
	port trunk allow-pass vlan 10
	qu

CE2

sy
sys CE2

vlan batch 10
int vlan 10
	ip add 10.1.1.2 24
	qu

int eth-trunk 1
	mode lacp-static
	trunkport g0/0/1
	port link-type trunk
	port trunk allow-pass vlan 10
	qu

查看BGP的evpn邻居情况

dis bgp evpn peer

image-20231102100957993

查看三台设备ESI

dis bgp evpn all esi

image-20231102143438706

可以看到, 由于PE1与PE2是连在同一个CE上的, 所以他们的ESI相同

查看PE的df情况

dis evpn vpn-instance name ES1 df result

image-20231102140509636

查看PE1的arp表, 此时PE1与PE2能够相互通信

image-20231102165819587

image-20231102165840886


开启evpn快速重路由功能(ENSP中不生效)

evpn 
	vlan-extend private enable
	vlan-extend redirect enable
	loacl-remote frr enable
	qu

在CE多归场景中, 通过mac路由重定向功能, 可以使联机同一个CE的PE设备都将去往该CE的MAC路由出接口重定向到本地AC接口, 从而缩短转发路径, 提升转发效率;

此外, 当其中一个PE上的AC接口故障时, MAC路由可以快速重定向出接口, 通过另外的多活PE转发, 提高网络的可靠性

3 L3单归

3.1 实验介绍

3.1.1 实验拓扑

image-20231113153220957

3.1.2 实验说明

两个ES中的CE为不同网段且不同物理地址的设备, 骨干网中配置BGP, CE1双活接入PE1与PE2

3.1.3 实验需求

配置EVPN L3 VPN承载三层业务, 不使用MPLS VPN, 使位于不同网段的CE1与CE2之间相互通信

3.2 配置流程

  1. 骨干网配置ISIS、MPLS LDP
  2. PE上配置L3 EVPN实例
  3. 骨干网建立EVPN BGP邻居
  4. CE接入PE

3.3 配置脚本

PE1

sy im
sys PE1
undo dcn
y
mpls lsr-id 1.1.1.1
mpls
	mpls ldp
	qu
isis 1
	network-entity 49.0001.0000.0000.0001.00
	is-level level-2
	cost-style wide
	qu
int ethe 1/0/0
	ip add 10.0.11.254 24
	qu
int ethe 1/0/1 
	isis enable
	mpls 
	mpls ldp
	ip add 10.0.14.1 24
	qu
int loop 0
	isis enable
	ip add 1.1.1.1 32
	qu

ip vpn-instance Site1
	ipv4-family
		route-distinguisher 100:1
		vpn-target 1:1 both
		evpn mpls routing-enable	#在L3VPN中启用EVPN, 通过EVPN发送的路由会带上MPLS标签值
		qu
	qu
ospf 1 vpn-instance Site1
	import-route bgp 100
	ar 0
		network 10.0.11.254 0.0.0.0
		qu
	qu
bgp 100
	router-id 1.1.1.1
	peer 4.4.4.4 as-number 100
	peer 4.4.4.4 connect-int loop0
	undo default ipv4-unicast
	l2vpn-family evpn 
		peer 4.4.4.4 enable
		y
		policy vpn-target
		qu
	ipv4-family vpn-instance Site1
		import-route ospf 1
		advertise l2vpn evpn	#手动将普通路由转换为EVPN路由并通告
		qu
	qu

int ethe1/0/0
	ip binding vpn-instance Site1
	ip add 10.0.11.254 24
	qu
evpn source-address 1.1.1.1

P1

sy im
sys P1
undo dcn
y
mpls lsr-id 4.4.4.4
mpls
	mpls ldp
	qu
isis 1
	network-entity 49.0001.0000.0000.0004.00
	is-level level-2
	cost-style wide
	qu

int ethe 1/0/1 
	isis enable
	mpls 
	mpls ldp
	ip add 10.0.14.4 24
	qu
int ethe 1/0/2
	isis enable
	mpls 
	mpls ldp
	ip add 10.0.24.4 24
	qu
int loop 0
	isis enable
	ip add 4.4.4.4 32
	qu

bgp 100
	router-id 4.4.4.4
	undo default ipv4-unicast
	peer 1.1.1.1 as-number 100
	peer 1.1.1.1 connect-int loop0
	peer 2.2.2.2 as-number 100
	peer 2.2.2.2 connect-int loop0
	l2vpn-family evpn
		peer 1.1.1.1 enable
		y
		peer 2.2.2.2 enable
		y
		qu
	qu
	
	

PE2

sy im
sys PE2
undo dcn
y
mpls lsr-id 2.2.2.2
mpls
	mpls ldp
	qu
isis 1
	network-entity 49.0001.0000.0000.0002.00
	is-level level-2
	cost-style wide
	qu
int ethe 1/0/0
	ip add 10.0.22.254 24
	qu
int ethe 1/0/1 
	isis enable
	mpls 
	mpls ldp
	ip add 10.0.24.2 24
	qu
int loop 0
	isis enable
	ip add 2.2.2.2 32
	qu

ip vpn-instance Site2
	ipv4-family
		route-distinguisher 200:1
		vpn-target 1:1 both
		evpn mpls routing-enable
		qu
	qu
ospf 1 vpn-instance Site2
	import-route bgp 100
	ar 0
		network 10.0.22.254 0.0.0.0
		qu
	qu
bgp 100
	router-id 2.2.2.2
	peer 4.4.4.4 as-number 100
	peer 4.4.4.4 connect-int loop0
	undo default ipv4-unicast
	l2vpn-family evpn 
		peer 4.4.4.4 enable
		y
		policy vpn-target
		qu
	ipv4-family vpn-instance Site2
		import-route ospf 1
		advertise l2vpn evpn
	qu

int ethe1/0/0
	ip binding vpn-instance Site2
	ip add 10.0.22.254 24
	qu
evpn source-address 2.2.2.2

CE1

sy 
sys CE1
int g0/0/1
	ip add 10.0.11.1 24
	qu
int loop 0
	ip add 11.11.11.11 32
	qu
ospf 1
	area 0
		network 10.0.11.1 0.0.0.0
		network 11.11.11.11 0.0.0.0
		qu
	qu

CE2

sy 
sys CE2
int g0/0/1
	ip add 10.0.22.1 24
	qu
int loop 0
	ip add 22.22.22.22 32
	qu
ospf 1
	area 0
		network 10.0.22.1 0.0.0.0
		network 22.22.22.22 0.0.0.0
		qu
	qu
	

配置验证需在两端PE上看到两端CE共4条路由(eNSP的bug会导致PE只能看到本侧CE的两条路由, 正巧我就遇到了这种情况, 无法复现实验结果)

dis bgp evpn all routing

最终CE1与CE2应可以相互ping通

4 实验总结

4.1 遇到问题

  1. ENSP上时常会有NE40E连接设备无法互通的情况, 可以反复多次开关NE40E直连的设备来尝试解决(不一定能解决), 就如我在L2单归实验场景时, PE2无法与CE2建立连接关系, 无法成功链路聚合, 导致esi无法生成, 进而导致L2VPN信息无法传递

    image-20231030150456647

    这种情况我的解决方法是在eth-trunk里再加一个接口G0/0/2, 然后直接将连线切到ethe1/0/0--GE0/0/2上

    image-20231031101622953

    然后聚合口就UP起来了, 可以在PE上查看ESI了

    image-20231031101651791

  2. (严重)L2双活实验中, 需要在CE与PE之间配置跨设备链路聚合, 在CE1上配置了eth-trunk, 在PE1和PE2上配置eth-turnk和e-trunk, CE1上能识别到PE1和PE2相同的system-id, 但始终无法同时Selected两条链路, 这种情况是什么问题导致的两条链路同时协商会失败?

    image-20231102155412021

    image-20231102155951818

    image-20231102161022431

    解决方法是在PE2上的eth-trunk也配置上(实验配置已补全修复命令)

    int eth-trunk 1
    	e-trunk mode force-master
    

    将ES1做一个双归双活, 来替代原来的双归单活, 双归单活在ENSP上存在协商bug, 这会导致CE2的ARP报文无法通过PE1&2传递给CE1

    此外, 如果是后面补全的命令, 需要重启CE1来重新进行链路协商, 否则CE1的eth-trunk上两个接口都会变为Unselect

4.2 疑问

  1. 在L2 VPN单归实验中, 为什么CE1和CE2与PE连接的聚合口需要配置的是trunk, 能不能使用access?

    当然是可以的, 这里并没有规定只有trunk才能进行转发, 但考虑到二层环境中可能不止有一个业务vlan存在, 所以通常情况下还是使用trunk.

  2. 在配置L3 VPN时, 为什么需要通过BGP的l2vpn地址簇传递evpn的路由信息?

4.3 实验心得

无论是L2/L3、单归/多归, EVPN的部署流程总结如下:

  1. 骨干网底层网络互联(ISIS、LDP)
  2. PE端起EVPN实例, 二层EVPN的VLAN Base模式需要配置BD域并进行子端口-BD域-EVPN实例的绑定
  3. 起BGP用于传递EVPN路由信息, 需要建立l2vpn邻居关系, 并且L3VPN中在EVPN实例地址簇中进行对应操作
  4. 配置EVPN源地址
  5. 测试连通性

4.4 参考资料

  1. 设备Eth-Trunk工作在LACP模式时,如何快速查看端口协商情况
  2. 静态LACP模式下Eth-Trunk成员接口无法转发流量
  3. E-trunk 和 M-LAG 联系与区别
  4. HCIE-路由交换专题-EVPN原理与配置
  5. ENSP之BGP-EVPN 双归接入模拟
posted @ 2023-11-13 17:17  Qurare  阅读(729)  评论(0编辑  收藏  举报