
基于Asterfusion CX-N设备部署BGP-EVPN-VXLAN
1 目标与物理网络拓扑
本文主要描述如何在Asterfusion CX308P-N和CX532P-N(以下简称CX308和CX532)搭建的网络上部署如下解决方案:
- BGP EVPN和VXLAN
在网络上承载VXLAN网络,将原本在服务器上进行的封装、去封装全部从Server端卸载到CX308内的VTEP上,并且在网络上启动BGP EVPN,自动化地创建VXLAN隧道、传递虚拟网络路由。
如上解决方案共用一个物理拓扑,如图1所示:

部署过程中所涉及到的设备、接口及管理网口的IP地址如下表1所示:
设备名称 | 设备型号 | IP地址 | 备注 |
Spine1 | CX532-N | 10.230.1.7 | |
Spine2 | CX532-N | 10.230.1.8 | |
Leaf1 | CX308-N | 10.230.1.18 | |
Leaf2 | CX308-N | 10.230.1.19 | |
Servrr1 | X86 | 10.230.1.11 | 互联网口ens1f2 |
Server2 | X86 | 10.230.1.12 | 互联网口ens1f3 |
2 硬件与软件环境
部署环境中涉及到的硬件和软件如表2和表3所示:
名称 | 型号 | 硬件指标 | 数量 | 备注 |
交换机 | CX532-N | 【参见产品彩页】 | 2 | 无 |
交换机 | CX308-N | 【参见产品彩页】 | 2 | 无 |
服务器 | X86 | 无 | 2 | 本方案采用10G网卡 |
光模块 | 10G | SFP+ | 4 | 无 |
光模块 | 100G | QSFP28 | 12 | 无 |
光纤 | 多模 | 100G适用 | 6 | 无 |
光纤 | 多模 | 10G/25G适用 | 2 | 无 |
名称 | 版本 | 备注 |
AFC | V5.0.0 | 无 |
服务器系统 | CentOS Linux 7.9.2009 | 无 |
服务器内核 | 3.10.0-1127.18.2.el7 | 无 |
3 解决方案:BGP EVPN和VXLAN
3.1 逻辑组网与配置思路

配置思路:
1)配置各交换机的端口IP信息
2)配置Leaf1和Leaf2的VLAN信息
3)配置各交换机的BGP
4)配置Leaf1和Leaf2使能EVPN
5)Leaf1和Leaf2创建Vnet,绑定VLAN
6)Leaf1和Leaf2配置二层和三层VXLAN映射
7)配置Server1和Server2的IP和路由信息
8)测试Server1和Server2的连通性
9)查看Leaf1的路由信息
10)查看Leaf2的路由信息
3.2 配置步骤
3.2.1 配置各交换机的端口IP信息
Spine1:
Spine1# configure terminal
Spine1(config)# interface ethernet 0/4
Spine1(config-if-0/4)# ip address 10.0.10.2/24
Spine1(config)# interface ethernet 0/8
Spine1(config-if-0/8)# ip address 10.0.11.2/24
Spine2:
Spine2# configure terminal
Spine2(config)# interface ethernet 0/4
Spine2(config-if-0/4)# ip address 10.1.10.2/24
Spine2(config)# interface ethernet 0/8
Spine2(config-if-0/8)# ip address 10.1.11.2/24
Leaf1:
Leaf1# configure terminal
Leaf1(config)# interface ethernet 0/48
Leaf1(config-if-0/4)# ip address 10.0.10.1/24
Leaf1(config)# interface ethernet 0/52
Leaf1(config-if-0/8)# ip address 10.1.10.1/24
Leaf2:
Leaf2# configure terminal
Leaf2(config)# interface ethernet 0/48
Leaf2(config-if-0/4)# ip address 10.0.11.1/24
Leaf2(config)# interface ethernet 0/52
Leaf2(config-if-0/8)# ip address 10.1.11.1/24
sudo config interface ip add Ethernet52 10.1.11.1/24
3.2.2 配置Leaf1和Leaf2的VLAN信息并配置好网口速率
Leaf1:
Leaf1# configure terminal
Leaf1(config)# vlan 10
Leaf1(config)# interface vlan 10
Leaf1(config-vlanif-10)# ip address 100.0.10.1/24
Leaf1(config-vlanif-10)# mac-address 18:17:25:55:17:69
Leaf1(config)# interface ethernet 0/2
Leaf1(config-if-0/2)# switchport access vlan 10
Leaf1(config-if-0/2)# speed 10000
Leaf2:
Leaf2# configure terminal
Leaf2(config)# vlan 20
Leaf2(config)# interface vlan 20
Leaf2(config-vlanif-20)# ip address 100.0.20.1/24
Leaf2(config-vlanif-20)# mac-address 18:17:25:55:17:71
Leaf2(config)# interface ethernet 0/3
Leaf2(config-if-0/3)# switchport access vlan 20
Leaf2(config-if-0/3)# speed 10000
3.2.3 配置各交换机的BGP
Spine1:
Spine1# configure terminal
Spine1(config)# router bgp 65228
Spine1(config-router)# bgp router-id 10.10.0.100
Spine1(config)# interface loopback 0
Spine1(config-loif-0)# ip address 10.10.0.100/32
Loopback ip will be used as bgp router-id in frr
Spine1(config)# router bgp 65228
Spine1(config-router)# no bgp ebgp-requires-policy
Spine1(config-router)# neighbor 10.0.10.1 remote-as 65230
Spine1(config-router)# neighbor 10.0.11.1 remote-as 65231
Spine1(config-router)# address-family ipv4 unicast
Spine1(config-router)# address-family l2vpn evpn
Spine1(config-router-af)# neighbor 10.0.10.1 activate
Spine1(config-router-af)# neighbor 10.0.11.1 activate
Spine1(config-router-af)# advertise-all-vni
Spine2:
Spine1# configure terminal
Spine1(config)# router bgp 65229
Spine1(config-router)# bgp router-id 10.10.0.110
Spine1(config)# interface loopback 0
Spine1(config-loif-0)# ip address 10.10.0.110/32
Loopback ip will be used as bgp router-id in frr
Spine1(config)# router bgp 65229
Spine1(config-router)# no bgp ebgp-requires-policy
Spine1(config-router)# neighbor 10.1.10.1 remote-as 65230
Spine1(config-router)# neighbor 10.1.11.1 remote-as 65231
Spine1(config-router)# address-family ipv4 unicast
Spine1(config-router)# address-family l2vpn evpn
Spine1(config-router-af)# neighbor 10.1.10.1 activate
Spine1(config-router-af)# neighbor 10.1.11.1 activate
Spine1(config-router-af)# advertise-all-vni
Leaf1:
Leaf1# configure terminal
Leaf1(config)# router bgp 65230
Leaf1(config-router)# bgp router-id 10.10.0.120
Leaf1(config)# interface loopback 0
Leaf1(config-loif-0)# ip address 10.10.0.120/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.120/32
Loopback ip will be used as bgp router-id in frr
Leaf1(config)# router bgp 65230
Leaf1(config-router)# no bgp ebgp-requires-policy
Leaf1(config-router)# neighbor 10.0.10.2 remote-as 65228
Leaf1(config-router)# neighbor 10.1.10.2 remote-as 65229
Leaf1(config-router)# address-family ipv4 unicast
Leaf1(config-router)# network 10.10.0.120/32
Leaf1(config-router)# address-family l2vpn evpn
Leaf1(config-router-af)# neighbor 10.0.10.2 activate
Leaf1(config-router-af)# neighbor 10.1.10.2 activate
Leaf1(config-router-af)# advertise-all-vni
Leaf2:
Leaf2# configure terminal
Leaf2(config)# router bgp 65231
Leaf2(config-router)# bgp router-id 10.10.0.130
Leaf2(config)# interface loopback 0
Leaf2(config-loif-0)# ip address 10.10.0.130/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.130/32
Loopback ip will be used as bgp router-id in frr
Leaf2(config)# router bgp 65231
Leaf2(config-router)# no bgp ebgp-requires-policy
Leaf2(config-router)# neighbor 10.0.11.2 remote-as 65228
Leaf2(config-router)# neighbor 10.1.11.2 remote-as 65229
Leaf2(config-router)# address-family ipv4 unicast
Leaf2(config-router)# network 10.10.0.130/32
Leaf2(config-router)# address-family l2vpn evpn
Leaf2(config-router-af)# neighbor 10.0.11.2 activate
Leaf2(config-router-af)# neighbor 10.1.11.2 activate
Leaf2(config-router-af)# advertise-all-vni
3.2.4 配置Leaf1和Leaf2使能EPVN
Leaf1:
Leaf1# configure terminal
Leaf1(config)# interface vxlan 0
Leaf1(config-vxlanif-0)# source 10.10.0.120
Leaf1(config)# evpn-overlay enable
Leaf2:
Leaf2# configure terminal
Leaf2(config)# interface vxlan 0
Leaf2(config-vxlanif-0)# source 10.10.0.130
Leaf2(config)# evpn-overlay enable
3.2.5 Leaf1和Leaf2创建Vnet,绑定VLAN
Leaf1:
Leaf1(config)# vrf 123
Leaf1(config-vrf)# mac 18:17:25:55:17:69
Leaf1(config-vrf)# interface vlan 10
Leaf1(config-vlanif-10)# vrf 123
Leaf2:
Leaf2(config)# vrf 456
Leaf2(config-vrf)# mac 18:17:25:55:17:71
Leaf2(config-vrf)# interface vlan 20
Leaf2(config-vlanif-20)# vrf 456
3.2.6 Leaf1和Leaf2配置二层和三层VXLAN映射
Leaf1:
Leaf1(config)# vlan 10
Leaf1(config-vlan-10)# vni 10
Leaf1(config)# vrf 123
Leaf1(config-vrf)# vni 1000
Leaf2:
Leaf2(config)# vlan 20
Leaf2(config-vlan-20)# vni 20
Leaf2(config)# vrf 456
Leaf2(config-vrf)# vni 1000
3.2.7 保存配置并重新加载
sonic# write
sonic# reload
3.2.8 配置Server1和Server2的IP和路由信息
Server1:
[root@server1 ~]# ifconfig ens1f2

[root@server1 ~]# route add -net 100.0.20.0 netmask 255.255.255.0 gw 100.0.10.1 dev ens1f2
Server2:

[root@server1 ~]# route add -net 100.0.10.0 netmask 255.255.255.0 gw 100.0.20.1 dev ens1f3
3.2.9 测试Server1和Server2的连通性
[root@server1 ~]# ping 100.0.20.3

[root@server1 ~]# ping 100.0.10.2

3.2.10 查看Leaf1的路由信息
查看VTEP信息
admin@Leaf1:~$ show evpn status

交换机路由信息
admin@Leaf1:~$ ip route show

下面信息显示Server2的路由转发到了Leaf1
admin@Leaf1:~$ ip neigh show nud all | grep Vlan

admin@Leaf1:~$ sudo bridge fdb |grep vxlan

admin@Leaf1:~$ show ip route vrf Vnet123

3.2.11 查看Leaf2的路由信息
查看VTEP信息
admin@Leaf2:~$ show evpn status

交换机路由信息
admin@Leaf2:~$ ip route show

下面信息显示Server2的路由转发到了Leaf1
admin@Leaf2:~$ ip neigh show nud all | grep Vlan

admin@Leaf2:~$ sudo bridge fdb |grep vxlan

admin@Leaf2:~$ show ip route vrf Vnet123

4 解决方案:AFC配置BGP和EVPN
4.1 逻辑组网与配置思路

配置思路:
1)配置设备的命令行模式
2)在Server2服务器上安装AFC软件,并在AFC Web上导入软件许可
3)在AFC上自动发现物理设备
4)在AFC上自动发现物理设备间的单向和双向链路
5)在AFC上创建Fabric,选择组网类型为Spine/Leaf
6)初始化环境确认
7)在AFC上配置设备BGP邻居
8)应用配置,AFC会自动下发配置到物理设备
9)在AFC上创建租户信息
10)在AFC上创建VPC组
11)在AFC上创建虚拟路由器
12)在AFC上创建虚拟交换机
13)在AFC上创建虚拟端口
14)测试Server1和Server2的连通性
15)查看Leaf1的路由信息
16)查看Leaf2的路由信息
4.2 配置步骤
4.2.1 安装AFC软件
下载AFC-NPB-V5.0.0软件包,在Server2服务器上安装AFC软件。具体操作请查看《AFC-NPB安装手册》,AFC安装完成之后,打开AFC Web端上传软件许可。


4.2.2 自动发现设备
【快速部署】—>【物理网络】—>【发现设备】
输入设备的起始和终止IP(10.230.1.7~10.230.1.8),(10.230.1.18~10.230.1.19)开始扫描。
4.2.3 自动发现链路
【快速部署】—>【物理网络】—>【发现链路】
自动发现链路,默认发现所有设备互联链路。
4.2.4 创建Fabric
【快速部署】—>【物理网络】—>【新建和配置Fabric】—>【添加Fabric】
选择Spine/Leaf类型,输入名称,添加设备,分配设备角色,并配置组网出入口,完成创建。

4.2.5 配置BGP邻居
【快速部署】—>【物理网络】—>【配置BGP】—>【同步设备邻居】

4.2.6 应用配置
【快速部署】—>【物理网络】—>【完成部署】—>【应用配置】
完成应用配置,大概等3分钟,等待配置下发物理设备。

4.2.7 创建租户信息
【虚拟网络】—>【独立部署场景】—>【租户】—>【新建租户】
新建租户,这里的租户代表用户本身,是配置网络的逻辑前提。

4.2.8 创建VPC
【虚拟网络】—>【独立部署场景】—>【VPC】—>【新建VPC】
新建VPC,选择租户和之前创建的Fabric组网。

4.2.9 创建虚拟路由器
【虚拟网络】—>【独立部署场景】—>【VPC】—>【内部资源】—>【虚拟路由器】—>【新建虚拟路由器】
新建虚拟路由器,预设两台Leaf设备的三层VNI和Fabric子网信息。

4.2.10 创建虚拟交换机
【虚拟网络】—>【独立部署场景】—>【VPC】—>【内部资源】—>【虚拟交换机】—>【新建虚拟交换机】
新建虚拟交换机,在Leaf设备上创建VLAN,并配置二层VXLAN映射;允许绑定子网,并配置三层VXLAN映射。

4.2.11 创建虚拟端口
【虚拟网络】—>【独立部署场景】—>【VPC】—>【内部资源】—>【虚拟端口】—>【新建虚拟端口】
新建虚拟端口,配置VLAN绑定的物理端口。

4.2.12 测试Server1和Server2的连通性
[root@server1 ~]# ping 100.0.20.3

[root@server2 ~]# ping 100.0.10.2

4.2.13 查看Leaf1的路由信息
查看VETP信息
admin@Leaf1:~$ show evpn status

查看交换机本身路由显示
admin@Leaf1:~$ ip route show

下面信息显示Server2的路由转发到了Leaf1
admin@Leaf1:~$ ip neigh show nud all|grep Vlan


admin@Leaf1:~$ show ip route vrf Vnet123

4.2.14 查看Leaf2的路由信息
查看VETP信息
admin@Leaf2:~$ show evpn status

查看交换机本身路由显示
admin@Leaf2:~$ ip route show

下面信息显示Server2的路由转发到了Leaf2
admin@Leaf2:~$ ip neigh show nud all|grep Vlan


admin@Leaf2:~$ show ip route vrf Vnet456

5 测试结果
- Server1和Server2之间使用交换机建立的VXLAN通道完成了通信;
- Leaf1和Leaf2对服务器之间的通信进行了VXLAN封装/去封装和L2/L3路由转发。
结论: VXLAN网络的封装、去封装可以从Server端卸载到CX308内的VTEP上,并且在网络上启动BGP EVPN,自动化地创建VXLAN隧道、传递虚拟网络路由。
更多内容请参考:A-Lab