005章节发布时(005集中式VXLAN项目实战案例),群里有朋友反馈,现在数据中心都是用分布式网关实验了,让出一篇分布式网关的实验,最好是说一些实际应用的案例。 本章节开始讲金融行业单个数据中心的后端业务区网络架构模型,也就是MP-BGP EVP分布式网关VXLAN项目实战。由于实验室的SDN控制器License到期了,后续有机会了再展示SDN控制器开局的配置场景。我个人是不喜欢SDN控制器零配置开局,即便是有控制器,我们的生产中心网络也是手工开局,规划好互联地址、RT、RT、等信息后,然后控制器纳管。
一、项目概述
本方案的原型是某证券期货行业的灾备数据中心后台业务区的SDN网络架构的简化版,IP地址和业务名称设备数量的缩小版,整体网络架构不变。业务区分为3个区域,各自可互相访问,其中为A区为核心账务区(包含柜面、信贷、对公结算等系统),B区为核心清算区(包含银企直连、代发工资、公积金结算等系统),C区数据监管区(包含数据库、客户交易、征信、反洗钱等系统)。Spine和Border二合一,双出口上联至金融骨干网与其他中心的后台业务区对接。东西向墙和南北向墙忽略,3个区域的属于同一个VPN-instanc内部,且可互相通信。(真实场景在单租户的基础上按照分区进行隔离,流量引流至东西墙)
005章节发布后,有读者留言说代码部分太长影响阅读体验。本实验的后续代码部分删除了冗余的配置,还原页面的可读性,同时把本项目的工程文件打包压缩作为附件。欢迎评论区留言或添加作者start_starting获取。
二、拓扑及需求
1. 网络拓扑

2. 网络需求
(1)后端业务核心区分为多个专用业务子分区,分别为A区10.1.1.0/24,B分区10.1.2.0/24、C分区10.1.3.0/24。
(2)分布式网关,网关为各子网的10.1.1.1、10.1.2.1、10.1.3.1。
(3)各网段之间和相互访问,且各Server都能访问互联网。
(4)要求Spine交换机配置为反射器,Leaf交换机配置为双活接入。
三、网络配置
1. 配置思路
(1)网络基础配置,配置互联接口地址和loopback接口地址。
(2)Underlay网络配置,所有的Spine节点和Leaf都处于OSPF Area0区域,所有的互联接口宣告进OSPF进程中。
(3)配置M-LAG协议,1对Spine节点、2对Leaf节点都部署M-LAG,其中Leaf节点的下行配置跨设备聚合链接服务器,服务器配置lacp链路聚合。实现服务器的双活接入。(这也就是所谓的双归接入,完全不用type1和type4的路由,详细见008章节的报文详解008 全网最全 EVPN 报文详解:抓包实战 + 交换机内部工作流程)
(4)配置MP-BGP EVPN完成VXLAN隧道的自动建立。注意M-LAG交换机之间需要配置bypass隧道,防止双归网络的单线中断,造成业务无法转发。
(5)配置Overlay网络创建分布式网关,在Border交换机配置至骨干网的静态路由,同时引入外部路由。传递给的overlay节点。
2. 配置步骤
(1)配置各个接口的互联地址及loopback接口的互联地址,配置OSPF路由协议实现Underlay网络三层互通。
以Leaf-1为例,Leaf2-Leaf4、Spine1-Spine2的基础配置详见附件。
[Leaf1]
sysname Leaf1
#
interface MEth0/0/0
ip binding vpn–instance _management_vpn_
ip address 192.168.69.13 255.255.255.0
#
interface GE1/0/1
undo portswitch
ip address 192.168.1.2 255.255.255.0
ospf network–type p2p
#
interface GE1/0/2
undo portswitch
ip address 192.168.5.2 255.255.255.0
ospf network–type p2p
#
interface LoopBack0
ip address 6.6.6.6 255.255.255.255
#
interface LoopBack1
ip address 2.2.2.2 255.255.255.255
#
interface LoopBack2
ip address 12.12.12.12 255.255.255.255
#
ospf 1 router–id 6.6.6.6
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 6.6.6.6 0.0.0.0
network 192.168.1.0 0.0.0.255
[Leaf1]
underlay网络配置完毕后,spine-leaf之间建立起ospf邻居获取到全网的路由。


(2)配置Spine之间、Leaf分别组成M-LAG系统。
以Leaf-1、Leaf-2这对Leaf为例子,演示M-LAG的配置。剩余的Spne和leaf配置详见附件。
注意:为防止单设备的上行双接口故障,在这里配置moniter-link进行检测和联动。
[Leaf1]
stp mode rstp
stp v-stp enable
#
dfs-group 1
dual-active detection source ip 6.6.6.6 peer 7.7.7.7
priority 150
#
interface Eth-Trunk1
mode lacp-static
peer-link 1
trunkport g1/0/3
trunkport g1/0/4
#
interface Eth-Trunk2
stp edged-port enable
trunkport g1/0/5
mode lacp-static
dfs-group 1 m-lag 1
#
interface Eth-Trunk3
stp edged-port enable
trunkport g1/0/6
mode lacp-static
dfs-group 1 m-lag 2
#
monitor-link group 1
port GE1/0/1 uplink
port GE1/0/2 uplink
port Eth-Trunk2 downlink 1
port Eth-Trunk3 downlink 2
[Leaf1]
(3)在成对的M-LAG组中配置Bypass通道,双归网络的下行单线中断导致的业务部分丢失。
以Leaf-1为例,Leaf2-Leaf4、Spine1-Spine2配置详见附件。
[Leaf1]
vlan 100
interface Vlanif100
ip address 10.2.2.1 255.255.255.252
reserved for vxlan bypass
ip route-static 13.13.13.13 255.255.255.255 10.2.2.2 preference 1
interface Nve1
pip-source 12.12.12.12 peer 13.13.13.13 bypass
[Leaf1]
(4)配置MP-BGP 建立EVPN对等体。
spine和leaf建立MP-BGP EVPN 邻居,生产中leaf节点数量较多,因此使用Spine作为双RR作为反射器,减少配置,同时兼顾冗余性。
以Spine-1为例,Spine2配置详见附件:
[Spine1]
evpn–overlay enable
bgp 100
router–id 4.4.4.4
private–4–byte–as enable
peer 6.6.6.6 as–number 100
peer 6.6.6.6 connect–interface LoopBack0
peer 7.7.7.7 as–number 100
peer 7.7.7.7 connect–interface LoopBack0
peer 8.8.8.8 as–number 100
peer 8.8.8.8 connect–interface LoopBack0
peer 9.9.9.9 as–number 100
peer 9.9.9.9 connect–interface LoopBack0
#
ipv4–family unicast
peer 6.6.6.6 enable
peer 7.7.7.7 enable
peer 8.8.8.8 enable
peer 9.9.9.9 enable
#
l2vpn–family evpn
undo policy vpn–target
peer 6.6.6.6 enable
peer 6.6.6.6 advertise irb
peer 6.6.6.6 reflect–client
peer 7.7.7.7 enable
peer 7.7.7.7 advertise irb
peer 7.7.7.7 reflect–client
peer 8.8.8.8 enable
peer 8.8.8.8 advertise irb
peer 8.8.8.8 reflect–client
peer 9.9.9.9 enable
peer 9.9.9.9 advertise irb
peer 9.9.9.9 reflect–client
[Spine1]
以Leaf-1为例,Leaf2-Leaf4配置详见附件:
[Leaf1]
bgp 100
private–4–byte–as enable
peer 4.4.4.4 as–number 100
peer 4.4.4.4 connect–interface LoopBack0
peer 5.5.5.5 as–number 100
peer 5.5.5.5 connect–interface LoopBack0
#
ipv4–family unicast
peer 4.4.4.4 enable
peer 5.5.5.5 enable
#
l2vpn–family evpn
policy vpn–target
peer 4.4.4.4 enable
peer 4.4.4.4 advertise irb
peer 5.5.5.5 enable
peer 5.5.5.5 advertise irb
[Leaf1]
(5) 配置VPN-Instance实例
以Spine-1为例,配置三层VPN实例和EVPN实例,同时创建NVE接口,动态建立VXLAN隧道。Spine-2配置详见附件:
注意:bgp vpn实例中提前配置引入了静态路由和发布了默认路由。
[Spine1]
ip vpn–instance vpn1
ipv4–family
route–distinguisher 4.4.4.4:1
vpn–target 0:1 export–extcommunity evpn
vpn–target 0:1 import–extcommunity evpn
vxlan vni 5000
bgp 100
#
ipv4–family vpn–instance vpn1
default–route imported
import–route static
advertise l2vpn evpn
#
interface Nve1
source 1.1.1.1
mac–address 0000–5e00–0101
以Leaf-1为例,配置三层VPN实例和EVPN实例,同时创建NVE接口,动态建立VXLAN隧道。Leaf2-Leaf4配置详见附件:
注意:bgp vpn实例中配置引入了直连路由。
[Leaf1]
ip vpn-instance vpn1
ipv4-family
route-distinguisher 6.6.6.6:1
vpn-target 0:1 export-extcommunity evpn
vpn-target 0:1 import-extcommunity evpn
vxlan vni 5000
#
bridge-domain 10
vxlan vni 10
#
evpn
route-distinguisher 6.6.6.6:10
vpn-target 0:10 export-extcommunity
vpn-target 0:1 export-extcommunity
vpn-target 0:10 import-extcommunity
#
bridge-domain 20
vxlan vni 20
#
evpn
route-distinguisher 6.6.6.6:20
vpn-target 0:20 export-extcommunity
vpn-target 0:1 export-extcommunity
vpn-target 0:20 import-extcommunity
#
bgp 100
#
ipv4-family vpn-instance vpn1
import-route direct
advertise l2vpn evpn
#
interface Nve1
source 2.2.2.2
pip-source 12.12.12.12 peer 13.13.13.13 bypass
vni 10 head-end peer-list protocol bgp
vni 20 head-end peer-list protocol bgp
mac-address 0000-5e00-0102
在Leaf节点上配置3层网关,以Leaf-1为例,配置vbdif的3层地址,注意绑定vpn-instance,同时不同leaf节点的同一个vbdif的3层接口地址均需要配置相同的mac地址。
[leaf1]
interface Vbdif10
ip binding vpn-instance vpn1
ip address 10.1.1.1 255.255.255.0
arp broadcast-detect enable
mac-address 00e0-fc00-0105
vxlan anycast-gateway enable
arp collect host enable
#
interface Vbdif20
ip binding vpn-instance vpn1
ip address 10.1.2.1 255.255.255.0
arp broadcast-detect enable
mac-address 00e0-fc00-0106
vxlan anycast-gateway enable
arp collect host enable
[leaf1]
(6)在Spine-Border上配置静态路由,同时引入到对应的BGP实例中。
注意:这里模拟器有一个Bug,配置跨VPN实例的路由必须要指定一个32位的下一跳地址,在真机上测试是不用添加的。真机部署时可以忽略32位的静态路由,只添加默认路由和24位掩码的路由即可。
Spine-2以及骨干网PE设备的配置详见附件。
[Spine1]
ip route–static 0.0.0.0 0.0.0.0 10.1.10.2
ip route–static 0.0.0.0 0.0.0.0 10.1.20.2
ip route–static 10.1.1.0 255.255.255.0 vpn–instance vpn1
ip route–static 10.1.1.10 255.255.255.255 vpn–instance vpn1 10.1.1.10
ip route–static 10.1.2.0 255.255.255.0 vpn–instance vpn1
ip route–static 10.1.2.10 255.255.255.255 vpn–instance vpn1 10.1.2.10
ip route–static 10.1.2.20 255.255.255.255 vpn–instance vpn1 10.1.2.20
ip route–static 10.1.3.0 255.255.255.0 vpn–instance vpn1
ip route–static 10.1.3.10 255.255.255.255 vpn–instance vpn1 10.1.3.10
ip route–static vpn–instance vpn1 0.0.0.0 0.0.0.0 public
ip route–static vpn–instance vpn1 8.8.8.8 255.255.255.255 10.1.10.2 public
ip route–static vpn–instance vpn1 8.8.8.8 255.255.255.255 10.1.20.2 public
[Spine1]
三、配置结果
1. VXLAN隧道配置
注意观察,leaf节点的vxlan隧道里面配置有bypass的静态隧道


2. MLAG聚合组状态

3. 双归接入配置


4. 连通性检查
数据中心内部全网互通

数据中心访问骨干网8.8.8.8 全通




四、附件
评论区留言或添加作者start_starting获取本项目完整工程文件。



