vxlan分布式网关部署案例

在这里插入图片描述

配置逻辑思维步骤:

1、配置同子网互访
2、配置不同子网互访(集中式或分布式)
3、所有的vtep配置相同的vbif接口,相同mac,相同IP,开户分布式网关功能,开启主机信息收集能力
4、在所有的EVPN邻居间开户IRB路由传递能力
5、创建三层VPN实例,配置RD,eirt,。 不同的的租户用不同的RD
6、将vbif接口划分到VPN实例中,相同租户,所有的子网划分到同一个VPN实例汇总,不同的租户的子网在不同的VPN实例中,可以实现租户隔离。
7、当VTEP学习到主机的ARP表项后,会生成IRB类型路由,可以 用pc 去ping 网关实现。
8、接收到一条IRB类型路由时:第一种情况 是使用路由带的RT:和本端EVPN实例下的IRT进行对比,相同就接受,后面用于arp广播抑制和vm热迁移。第二种情况是和本端的L3 VPN实例下的IRT进行对比,如果相同,就接受,并在L3 VPN实例下的路由表中创建一条主机路由。

IRb路由信息内容解释 :

RT:取值是EVPN实例下的ERT
VTEP IP:本端的VTEP地址
二层VNI:取值是EVPN实例下的VNI
三层VNI:VBIF接口,属于L3 VPN实例下的三层VNI值
MAC:ARP表项中的MAC地址
IP: ARP表中的IP地址

ERT和IRT是啥:

EVPN实例中的RT值根据方向称为ERT或者IRT,而L3VPN实例中的RT值根据方法称为eIRT或者eERT。

关键参数说明:

检查该路由的ERT与接收端EVPN实例的IRT是否相同。如果相同,则接收该路由,同时EVPN实例提取其中包含的主机IP加MAC信息,用于主机ARP通告。

检查该路由的ERT与接收端L3VPN实例的eIRT是否相同。如果相同,则接收该路由,同时L3VPN实例提取其中的主机IP地址+三层VNI信息,在其路由表中生成Host的路由。该路由的下一跳会被设置为对端Leaf的VXLAN隧道接口。

接收端EVPN实例或L3VPN实例接收该路由后会通过下一跳获取对端Leaf的VTEP IP地址,如果该地址三层路由可达,则建立一条到对端Leaf的VXLAN隧道。

type2 的mac/ip路由:
mac路由:主要用于在vtep之间动态学习mac地址,只会携带mac地址 没有ip地址
arp:携带mac地址,ip地址,不带三层vni信息
IRB:携带mac地址,IP地址,带三层vni信息

同网段互访:封装二层vni,用于识别不同的bd
不同网段互访:封装三层vni,用于标识不同的L3 vpn实例。

跨子网通信原理流程分析:

Leaf-1收到来自PC1的报文,检测到报文的目的MAC是网关接口MAC,判断该报文需要进行三层转发。
Leaf-1根据报文的入接口找到对应的二层广播域,然后找到绑定该广播域VBDIF接口的VPN实例。根据报文的目的IP地址,查找该VPN实例下的路由表,获取该路由对应的三层VNI,以及下一跳地址。再根据出接口是VXLAN隧道,

判断需要进行VXLAN封装:
1.根据VXLAN隧道的目的IP和源IP地址,获取对应的MAC地址,并将内层目的MAC和源MAC替换。
2.将三层VNI封装到报文中。
3.外层封装VXLAN隧道的目的IP和源IP地址,源MAC地址为Leaf1的VBDIF接口MAC地址,目的MAC地址为网络下一跳的MAC地址。
封装后的报文根据外层MAC和IP信息在IP网络中传输,送达Leaf-2。
Leaf-2收到VXLAN报文后进行解封装,检测到报文的目的MAC是自己的MAC地址,判断该报文需要进行三层转发。
Leaf-2根据报文携带的三层VNI找到对应的VPN实例,通过查找该VPN实例下的路由表,获取报文的下一跳是网关接口地址,然后将目的MAC地址替换为PC3的MAC地址,源MAC地址替换为Leaf2的MAC地址,转发给PC3

最终实现全部pc贯通且能和server服务器通信

关联图:

在这里插入图片描述

CE4配置:

evpn-overlay enable

ip vpn-instance a
ipv4-family
route-distinguisher 10:3
vpn-target 10:3 export-extcommunity evpn
vpn-target 100:2 import-extcommunity evpn
vpn-target 200:2 import-extcommunity evpn
vxlan vni 999
//这里将RD值设置100:3,eERT为100:3,eIRT分别为100:2,200:2 分别对应Leaf-1和Leaf-2上设置的ERT值,目的是接收这些EVPN实例发送的路由信息

interface GE1/0/0
undo portswitch
undo shutdown
ip address 10.0.45.4 255.255.255.0

interface GE1/0/1
undo portswitch
undo shutdown
ip address 10.0.46.4 255.255.255.0

interface GE1/0/2
undo portswitch
undo shutdown
ip binding vpn-instance a
ip address 192.168.30.1 255.255.255.0

interface LoopBack0
ip address 4.4.4.4 255.255.255.255

interface Nve1
source 4.4.4.4

interface NULL0

bgp 100
peer 5.5.5.5 as-number 100
peer 5.5.5.5 connect-interface LoopBack0
peer 6.6.6.6 as-number 100
peer 6.6.6.6 connect-interface LoopBack0

ipv4-family unicast
peer 5.5.5.5 enable
peer 6.6.6.6 enable

ipv4-family vpn-instance a
network 192.168.30.0 255.255.255.0
advertise l2vpn evpn

l2vpn-family evpn
undo policy vpn-target
peer 5.5.5.5 enable
peer 5.5.5.5 advertise irb
peer 5.5.5.5 reflect-client
peer 6.6.6.6 enable
peer 6.6.6.6 advertise irb
peer 6.6.6.6 reflect-client
//在三台设备的BGP中激活IRP路由传递的功能irb

ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 10.0.45.4 0.0.0.0
network 10.0.46.4 0.0.0.0

CE5配置:

evpn-overlay enable

ip vpn-instance a
ipv4-family
route-distinguisher 10:10
vpn-target 200:2 import-extcommunity evpn
vpn-target 100:2 import-extcommunity evpn
vpn-target 10:3 import-extcommunity evpn
vxlan vni 999
//为了接收Spine发送的type 5路由,Leaf-1的L3VPN实例上也要设置eIRT为10:3

bridge-domain 10
vxlan vni 10
evpn
route-distinguisher 100:1
vpn-target 100:2 export-extcommunity
vpn-target 100:2 import-extcommunity

bridge-domain 20
vxlan vni 20
evpn
route-distinguisher 200:1
vpn-target 200:2 export-extcommunity
vpn-target 200:2 import-extcommunity

interface Vbdif10
ip binding vpn-instance a
ip address 192.168.10.1 255.255.255.0
vxlan anycast-gateway enable
arp collect host enable
//设备处开启收集arp信息,并通过BGP EVPN type 2路由进行传递

interface Vbdif20
ip binding vpn-instance a
ip address 192.168.20.1 255.255.255.0
vxlan anycast-gateway enable
arp collect host enable
//设备处开启收集arp信息,并通过BGP EVPN type 2路由进行传递

interface MEth0/0/0
undo shutdown

interface GE1/0/0
undo portswitch
undo shutdown
ip address 10.0.45.5 255.255.255.0

interface GE1/0/1
undo shutdown

interface GE1/0/1.10 mode l2
encapsulation dot1q vid 10
bridge-domain 10

interface GE1/0/1.20 mode l2
encapsulation dot1q vid 20
bridge-domain 20

interface LoopBack0
ip address 5.5.5.5 255.255.255.255

interface Nve1
source 5.5.5.5
vni 10 head-end peer-list protocol bgp
vni 20 head-end peer-list protocol bgp

interface NULL0

bgp 100
peer 4.4.4.4 as-number 100
peer 4.4.4.4 connect-interface LoopBack0

ipv4-family unicast
peer 4.4.4.4 enable

l2vpn-family evpn
policy vpn-target
peer 4.4.4.4 enable
peer 4.4.4.4 advertise irb
//在三台设备的BGP中激活IRP路由传递的功能irb

ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 10.0.45.5 0.0.0.0

CE6配置:

evpn-overlay enable

ip vpn-instance a
ipv4-family
route-distinguisher 10:10
vpn-target 200:2 import-extcommunity evpn
vpn-target 100:2 import-extcommunity evpn
vpn-target 10:3 import-extcommunity evpn
vxlan vni 999
//为了接收Spine发送的type 5路由,Leaf-2的L3VPN实例上也要设置eIRT为10:3

bridge-domain 10
vxlan vni 10
evpn
route-distinguisher 100:1
vpn-target 100:2 export-extcommunity
vpn-target 100:2 import-extcommunity

bridge-domain 20
vxlan vni 20
evpn
route-distinguisher 200:1
vpn-target 200:2 export-extcommunity
vpn-target 200:2 import-extcommunity

interface Vbdif10
ip binding vpn-instance a
ip address 192.168.10.1 255.255.255.0
vxlan anycast-gateway enable
arp collect host enable
//设备处开启收集arp信息,并通过BGP EVPN type 2路由进行传递

interface Vbdif20
ip binding vpn-instance a
ip address 192.168.20.1 255.255.255.0
vxlan anycast-gateway enable
arp collect host enable
//设备处开启收集arp信息,并通过BGP EVPN type 2路由进行传递

interface MEth0/0/0
undo shutdown

interface GE1/0/0
undo portswitch
undo shutdown
ip address 10.0.46.6 255.255.255.0

interface GE1/0/1
undo shutdown

interface GE1/0/1.10 mode l2
encapsulation dot1q vid 10
bridge-domain 10

interface GE1/0/1.20 mode l2
encapsulation dot1q vid 20
bridge-domain 20

interface LoopBack0
ip address 6.6.6.6 255.255.255.255

interface Nve1
source 6.6.6.6
vni 10 head-end peer-list protocol bgp
vni 20 head-end peer-list protocol bgp

interface NULL0

bgp 100
peer 4.4.4.4 as-number 100
peer 4.4.4.4 connect-interface LoopBack0

ipv4-family unicast
peer 4.4.4.4 enable

l2vpn-family evpn
policy vpn-target
peer 4.4.4.4 enable
peer 4.4.4.4 advertise irb
//在三台设备的BGP中激活IRP路由传递的功能irb

ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 10.0.46.6 0.0.0.0

在这里插入图片描述
在这里插入图片描述

查看evpn的bgp邻居是否建立
在这里插入图片描述

dis bgp evpn all routing-table
在这里插入图片描述

查看隧道建立情况
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

最终PC1可以ping通所有的pc
在这里插入图片描述

ping服务器:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/ydaxia110/article/details/134727966