Skip to main content
开放网络的先行者与推动者—星融元
加入我们技术支持(Support)  TEL:(+86)4000989811

国产RoCE网卡测试报告

1 目标与物理网络拓扑

本文主要描述如何在光润通国产100G RoCEv2网卡(以下简称GRT)和飞迈瑞克国产100G RoCEv2网卡(以下简称Femrice)搭建的网络上针对HPC场景进行性能/时延测试,具体方案如下:

  • E2E转发测试

测试两款国产网卡在相同拓扑E2E(End to End)的转发时延和带宽,本次方案测试点采用Perftest通信测试工具包进行发包,测试过程遍历2~8388608字节。

  • HPC应用测试

本次测试方案在相同场景下运行HPC应用,比较GTP和Femrice两款国产网卡的运行速度(时间更短)。

1.1 GRT物理拓扑

如上解决方案的IB交换机物理拓扑,如图1所示:

GRT网卡

图1:GRT网卡物理网络拓扑

1.2 Femrice物理拓扑

如上解决方案的Femrice物理拓扑,如图2所示:

Femrice网卡

图2:Femrice网卡物理网络拓扑

1.3 管理口IP规划

测试过程中涉及到设备的管理网口和业务口的的IP地址如表1所示:

设备名称接口IP地址备注
Server1管理口192.168.4.144/
业务口ens1f0100.0.1.10GRT网卡RoCEv2模式直连
业务口ens1f1100.0.2.10Femrice网卡RoCEv2模式直连
Server2管理口192.168.4.145/
业务口ens1f0100.0.1.11GRT网卡RoCEv2模式直连
业务口ens1f1100.0.2.11Femrice网卡RoCEv2模式直连
表1:管理口和业务口IP规划

2 硬件与软件环境

部署环境中涉及到的硬件和软件如表2和表3所示:

名称型号硬件指标数量备注
服务器x86Intel(R) Xeon(R) CPU E5-2678 v3 @ 2.50GHz,48核
内存:128G
2需安装100G网卡
光模块100GQSFP284
光纤多模100G适用2
Femrice网卡FM- E810CAM2-QF2Interl E810-C2/
GRTF1102E-v4.0Interl E810-C2/
表2:硬件环境
名称版本备注
操作系统CentOS Linux release 7.8.2003 (Core)
内核3.10.0-1127.18.2.el7.x86_64
Intel网卡驱动ice-1.9.11https://www.intel.cn/
RDMA网卡驱动irdma-1.11.16.6https://www.intel.cn/
WRFWRFV4.0https://www2.mmm.ucar.edu
LAMMPSLAMMPS(3 Mar 2020)https://github.com/lammps/lammps/
PerftestV4.5-0.20https://github.com/linux-rdma/perftest
表3:软件环境

3 测试环境部署

在两台Server服务器上,安装部署HPC两种测试场景所需的基础环境。

补充说明:以”[root@server ~]#”为开头的命令表示两台服务器都要执行。

3.1 网卡驱动部署

在两台Server服务器上安装网卡所需的ice和irdma驱动程序以及Perftest测试工具集,网卡驱动安装完成之后检查网卡及驱动状态,确保网卡可以正常使用。

3.1.1 网卡ice驱动程序安装

[root@Server ~]# wget https://downloadmirror.intel.com/763930/ice-1.9.11.tar.gz
[root@Server ~]# tar zxf  ice-1.9.11.tar.gz
[root@Server ~]# cd ice-1.9.11/src/
[root@Server src]# make install 
[root@Server src]# modinfo ice
[root@Server src]# modprobe ice
[root@Server src]# ethtool -i ens1f0
driver: ice
version: 1.9.11
firmware-version: 3.20 0x8000d84c 1.3146.0
expansion-rom-version: 
bus-info: 0000:02:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: yes

3.1.2 网卡irdma驱动程序安装

[root@Server ~]# wget https://downloadmirror.intel.com/763932/irdma-1.11.16.6.tgz
[root@Server ~]# tar zxf  irdma-1.11.16.6.tgz
[root@Server ~]# cd irdma-1.11.16.6/
[root@Server irdma-1.11.16.6]# ./build
[root@Server irdma-1.11.16.6]# modprobe irdma
[root@Server ~]# wget https://github.com/linux-rdma/rdma-core/release/download/v42.0/rdma-core-42.0.tar.gz
[root@Server ~]# tar -xzvf rdma-core-42.0.tar.gz
[root@Server ~]# cd rdma-core-42.0/
[root@Server rdma-core-42.0]# patch -p2 < /root/ ice-1.9.11/libirdma-42.0.patch
[root@Server rdma-core-42.0]# cd ..
[root@Server ~]# chgrp -R root rdma-core-42.0/redhat
[root@Server ~]# chgrp -R root rdma-core-42.0/redhat
[root@Server ~]# mkdir -p ~/rpmbuild/SOURCES
[root@Server ~]# mkdir -p ~/rpmbuild/SPECS
[root@Server ~]# cp rdma-core-42.0.tgz ~/rpmbuild/SOURCES/
[root@Server SOURCES]# cd ~/rpmbuild/SOURCES
[root@Server SOURCES]# tar -xzvf rdma-core-42.0.tgz
[root@Server SOURCES]# cp ~/rpmbuild/SOURCES/rdma-core-42.0/redhat/rdma-core.spec ~/rpmbuild/SPECS/
[root@Server SPECS]# cd ~/rpmbuild/SPECS/
[root@Server SPECS]# rpmbuild -ba rdma-core.spec
[root@Server SPECS]# cd ~/rpmbuild/RPMS/x86_64
[root@Server x86_64]# yum install *42.0*.rpm
3.1.2.1 Perfest性能测试工具集
[root@Server ~]# git clone https://github.com/linux-rdma/perftest.git
[root@Server ~]# cd perftest
[root@Server perftest]# ./autogen.sh
[root@Server perftest]# ./configure
[root@Server perftest]# make
[root@Server perftest]# make install

4 WRF运行环境部署

4.1 安装环境准备

4.1.1 创建文件目录

[root@Server1 ~]# cd /data/home/wrf01/202302test/
[root@Server1 202302test]# mkdir Build_WRF
[root@Server1 202302test]# mkdir TESTS

4.1.2 安装编译器

[root@Server1 ~]# yum -y install gcc cpp gcc-gfortran gcc-g++ m4 make csh

4.1.3 添加环境变量

[root@Server1 ~]# vi ~/.bashrc
export DIR=/data/home/wrf01/202302test/Build_WRF/LIBRARIES
export CC=gcc
export CXX=g++
export FC=gfortran
export CFLAGS='-m64'
export F77=gfortran
export FFLAGS='-m64'
export PATH=$DIR/mpich/bin:$PATH
export PATH=$DIR/netcdf/bin:$PATH
export NETCDF=$DIR/netcdf
export JASPERLIB=$DIR/grib2/lib
export JASPERINC=$DIR/grib2/include
export LDFLAGS=-L$DIR/grib2/lib
export CPPFLAGS=-I$DIR/grib2/include
export LD_LIBRARY_PATH=$DIR/grib2/lib:$LD_LIBRARY_PATH
[root@Server1 ~]# source ~/.bashrc

4.2 安装三方依赖库

4.2.1 创建文件目录

[root@Server1 ~]# cd /data/home/wrf01/202302test/Build_WRF
[root@Server1 Build_WRF]# mkdir LIBRARIES

4.2.2 下载第三方库

[root@Server1 Build_WRF]# wget \ https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/zlib-1.2.7.tar.gz
[root@Server1 Build_WRF]# wget \ https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/mpich-3.0.4.tar.gz
[root@Server1 Build_WRF]# wget \ https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/netcdf-4.1.3.tar.gz
[root@Server1 Build_WRF]# wget \ https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/jasper-1.900.1.tar.gz
[root@Server1 Build_WRF]# wget \ https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/libpng-1.2.50.tar.gz

4.2.3 编译安装zlib

[root@Server1 Build_WRF]# tar xzvf zlib-1.2.7.tar.gz 
[root@Server1 Build_WRF]# cd zlib-1.2.7    
[root@Server1 zlib-1.2.7]# ./configure --prefix=$DIR/grib2
[root@Server1 zlib-1.2.7]# make
[root@Server1 zlib-1.2.7]# make install

4.2.4 编译安装libpng

[root@Server1 Build_WRF]# tar xzvf libpng-1.2.50.tar.gz
[root@Server1 Build_WRF]# cd  libpng-1.2.50
[root@Server1 libpng-1.2.50]# ./configure --prefix=$DIR/grib2
[root@Server1 libpng-1.2.50]# make
[root@Server1 libpng-1.2.50]# make install

4.2.5 编译安装mpich

[root@Server1 Build_WRF]# tar xzvf mpich-3.0.4.tar.gz 
[root@Server1 Build_WRF]# cd  mpich-3.0.4
[root@Server1 mpich-3.0.4]# ./configure --prefix=$DIR/mpich
[root@Server1 mpich-3.0.4]# make
[root@Server1 mpich-3.0.4]# make install

4.2.6 编译安装jasper

[root@Server1 Build_WRF]# tar xzvf jasper-1.900.1.tar.gz 
[root@Server1 Build_WRF]# cd  jasper-1.900.1
[root@Server1 jasper-1.900.1]# ./configure --prefix=$DIR/grib2
[root@Server1 jasper-1.900.1]# make
[root@Server1 jasper-1.900.1]# make install

4.2.7 编译安装netcdf

[root@Server1 Build_WRF]# tar xzvf netcdf-4.1.3.tar.gz
[root@Server1 Build_WRF]# cd  netcdf-4.1.3
[root@Server1 netcdf-4.1.3]# ./configure --prefix=$DIR/netcdf \
--disable-dap --disable-netcdf-4 --disable-shared
[root@Server1 netcdf-4.1.3]# make
[root@Server1 netcdf-4.1.3]# make install

4.2.8 依赖库测试

[root@Server1 Build_WRF]# cd TESTS
[root@Server1 TESTS]# wget \ https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compile_tutorial/tar_files/Fortran_C_NETCDF_MPI_tests.tar
[root@Server1 TESTS]# tar -xf Fortran_C_NETCDF_MPI_tests.tar

测试Fortran+C+NetCDF:
[root@Server1 TESTS]# cp ${NETCDF}/include/netcdf.inc .
[root@Server1 TESTS]# gfortran -c 01_fortran+c+netcdf_f.f
[root@Server1 TESTS]# gcc -c 01_fortran+c+netcdf_c.c
[root@Server1 TESTS]# gfortran 01_fortran+c+netcdf_f.o \  01_fortran+c+netcdf_c.o \-L${NETCDF}/lib -lnetcdff -lnetcdf
[root@Server1 TESTS]# ./a.out

测试Fortran+C+NetCDF+MPI:
[root@Server1 TESTS]# cp ${NETCDF}/include/netcdf.inc .
[root@Server1 TESTS]# mpif90 -c 02_fortran+c+netcdf+mpi_f.f
[root@Server1 TESTS]# mpicc -c 02_fortran+c+netcdf+mpi_c.c
[root@Server1 TESTS]# mpif90 02_fortran+c+netcdf+mpi_f.o 02_fortran+c+netcdf+mpi_c.o -L${NETCDF}/lib -lnetcdff -lnetcdf
[root@Server1 TESTS]# mpirun ./a.out

4.3 安装WRF

4.3.1 下载WRFV4.0

[root@Server1 ~]# cd /data/home/wrf01/202302test/Build_WRF
[root@Server1 Build_WRF]# wget \ https://www2.mmm.ucar.edu/wrf/src/WRFV4.0.TAR.gz
[root@Server1 Build_WRF]# tar xzvf WRFV4.0.TAR.gz
[root@Server1 Build_WRF]# cd WRF

4.3.2 安装WRF

[root@Server1 WRF]# ./configure
命令行
[root@Server1 WRF]# ./compile
[root@Server1 WRF]# ls -ls main/*.exe
命令行

4.4 安装WPS

4.4.1 下载WPSV4.0

[root@Server1 ~]# cd /data/home/wrf01/202302test/Build_WRF
[root@Server1 Build_WRF]# wget \
https://www2.mmm.ucar.edu/wrf/src/WPSV4.0.TAR.gz
[root@Server1 Build_WRF]# tar xzvf WRFV4.0.TAR.gz
[root@Server1 Build_WRF]# cd WPS
[root@Server1 WPS]# ./clean

4.4.2 修改intmath.f文件

[root@Server1 WPS]# cat ./ungrib/src/ngl/g2/intmath.f
命令行

4.4.3 安装WPS

[root@Server1 WPS]# ./configure
Enter selection [1-40] : 1
[root@Server1 WPS]# ./compile
[root@Server1 WPS]# ls -las *.exe
命令行
max_dom = 1,
 start_date = '2000-01-24_12:00:00',
 end_date   = '2000-01-26_00:00:00',
 interval_seconds = 21600
 io_form_geogrid = 2,
/

&geogrid
 parent_id         =   1,   1,
 parent_grid_ratio =   1,   3,
 i_parent_start    =   1,  31,
 j_parent_start    =   1,  17,
 e_we              =  104, 142,
 e_sn              =  61,  97,
geog_data_res = '10m','2m',
 dx = 30000,
 dy = 30000,
 map_proj = 'lambert',
 ref_lat   =  34.83,
 ref_lon   = -81.03,
 truelat1  =  30.0,
 truelat2  =  60.0,
 stand_lon = -98.0,
 geog_data_path = '/data/home/wrf01/202302test/Build_WRF/WPS_GEOG/WPS_GEOG/'
/

&ungrib
 out_format = 'WPS',
 prefix = 'FILE',
/

&metgrid
 fg_name = 'FILE'
 io_form_metgrid = 2, 
/

4.4.4 下载静态地理数据

[root@Server1 ~]# cd /data/home/wrf01/202302test/Build_WRF
[root@Server1 Build_WRF]# mkdir WPS_GEOG
下载链接:https://www2.mmm.ucar.edu/wrf/users/download/get_sources_wps_geog.html

4.5 WRF可执行文件

4.5.1 下载WPSV4.0

[root@Server1 ~]# cd /data/home/wrf01/202302test/Build_WRF
[root@Server1 Build_WRF]# mkdir DATA
[root@Server1 Build_WRF]# vi WRF/test/em_real/namelist.input
&time_control
 run_days                            = 0,
 run_hours                           = 36,
 run_minutes                         = 0,
 run_seconds                         = 0,
 start_year                          = 2000, 2000, 2000,
 start_month                         = 01,   01,   01,
 start_day                           = 24,   24,   24,
 start_hour                          = 12,   12,   12,
 end_year                            = 2000, 2000, 2000,
 end_month                           = 01,   01,   01,
 end_day                             = 26,   25,   25,
 end_hour                            = 00,   12,   12,
 interval_seconds                    = 21600
 input_from_file                     = .true.,.true.,.true.,
 history_interval                    = 180,  60,   60,
 frames_per_outfile                  = 1000, 1000, 1000,
 restart                             = .false.,
 restart_interval                    = 5000,
 io_form_history                     = 2
 io_form_restart                     = 2
 io_form_input                       = 2
 io_form_boundary                    = 2
 /

 &domains
 time_step                           = 180,
 time_step_fract_num                 = 0,
 time_step_fract_den                 = 1,
 max_dom                             = 1,
 e_we                                = 104,    142,   94,
 e_sn                                = 61,    97,    91,
 e_vert                              = 34,    34,    34,
 p_top_requested                     = 4500,
 num_metgrid_levels                  = 27,
 num_metgrid_soil_levels             = 2,
 dx                                  = 30000, 10000,  3333.33,
 dy                                  = 30000, 10000,  3333.33,
 grid_id                             = 1,     2,     3,
 parent_id                           = 0,     1,     2,
 i_parent_start                      = 1,     31,    30,
 j_parent_start                      = 1,     17,    30,
 parent_grid_ratio                   = 1,     3,     3,
 parent_time_step_ratio              = 1,     3,     3,
 feedback                            = 1,
 smooth_option                       = 0
 /

 &physics
 physics_suite                       = 'CONUS'
 mp_physics                          = -1,    -1,    -1,
 cu_physics                          = -1,    -1,     0,
 ra_lw_physics                       = -1,    -1,    -1,
 ra_sw_physics                       = -1,    -1,    -1,
 bl_pbl_physics                      = -1,    -1,    -1,
 sf_sfclay_physics                   = -1,    -1,    -1,
 sf_surface_physics                  = -1,    -1,    -1,
 radt                                = 30,    30,    30,
 bldt                                = 0,     0,     0,
 cudt                                = 5,     5,     5,
 icloud                              = 1,
 num_land_cat                        = 21,
 sf_urban_physics                    = 0,     0,     0,
 /

 &fdda
 /

 &dynamics
 hybrid_opt                          = 2, 
 w_damping                           = 0,
 diff_opt                            = 1,      1,      1,
 km_opt                              = 4,      4,      4,
 diff_6th_opt                        = 0,      0,      0,
 diff_6th_factor                     = 0.12,   0.12,   0.12,
 base_temp                           = 290.
 damp_opt                            = 3,
 zdamp                               = 5000.,  5000.,  5000.,
 dampcoef                            = 0.2,    0.2,    0.2
 khdif                               = 0,      0,      0,
 kvdif                               = 0,      0,      0,
 non_hydrostatic                     = .true., .true., .true.,
 moist_adv_opt                       = 1,      1,      1,     
 scalar_adv_opt                      = 1,      1,      1,     
 gwd_opt                             = 1,
 /

 &bdy_control
 spec_bdy_width                      = 5,
 specified                           = .true.
 /

 &grib2
 /

 &namelist_quilt
 nio_tasks_per_group = 0,
 nio_groups = 1,
 /

4.5.2 生成地理数据

[root@Server1 WPS]# ./geogrid.exe
[root@Server1 WPS]# ls -lah geo_em.d01.nc

4.5.3 下载并链接气象数据

气象数据下载网址:https://rda.ucar.edu/

[root@Server1 Build_WRF]# mkdir DATA
[root@Server1 Build_WRF]# ls -lah ./DATA/JAN00/fnl*
命令行
[root@Server1 Build_WRF]# cd WPS
[root@Server1 WPS]# ./link_grib.csh ../DATA/JAN00/fnl
[root@Server1 WPS]# ln -sf ungrib/Variable_Tables/Vtable.GFS Vtable
[root@Server1 WPS]# ./ungrib.exe
[root@Server1 WPS]# ls -lah FILE*
命令行

4.5.4 融合气象和地理数据

[root@Server1 WPS]# ./metgrid.exe

4.5.5 链接WPS到WRF

[root@Server1 WPS]#  cd ../WRF/test/em_real/
[root@Server1 em_real]# ln -sf ~/Build_WRF/WPS/met_em* .
[root@Server1 em_real]# mpirun -np 1 ./real.exe
[root@Server1 em_real]# ls -alh wrfbdy_d01 wrfinput_d01

5 GRT国产100G RoCEv2网卡

5.1 E2E转发测试

配置网卡工作模式RoCEv2,使用ib_read_lat和ib_read_bw工具在服务器Server1上建立发包服务端,在Server2上建立发包客户端,测试GRT网卡直连情况下的带宽和时延。

5.1.1 基础配置

[root@Server ~]# rmmod irdma
[root@Server ~]# modprobe irdma roce_ena=1
[root@Server ~]# ibv_devices
    device          	   node GUID
    ------          	----------------
    rdmap2s0f0      	5a53c0fffe790004
irdma1          	5a53c0fffe790005
[root@Server ~]# ibv_devinfo rdmap2s0f0
 
[root@Server1 ~]# ifconfig ens1f0 100.0.1.10 up
[root@Server2 ~]# ifconfig ens1f0 100.0.1.11 up
命令行
[root@Server1 ~]# ifconfig ens1f0 100.0.1.10 up
[root@Server2 ~]# ifconfig ens1f0 100.0.1.11 up

5.1.2 GRT网卡直连

[root@Server1 ~]# ib_read_lat -R -d rdmap2s0f0 -F --report_gbits -a
[root@Server2 ~]# ib_read_lat -a -R -x 5 -d rdmap2s0f0 -F -f 2 100.0.1.10
[root@Server1 ~]# ib_read_bw -R -d rdmap2s0f0 -F --report_gbits -a
[root@Server2 ~]# ib_read_bw -a -R -x 5 -d rdmap2s0f0 -F -f 2 100.0.1.10

5.2 HPC应用测试

在两台服务器上使用WRF开源气象模拟软件和LAMMPS高分子计算进行数据测试,测试GTR国产网卡完成并行计算运行所需时间。

5.2.1 WRF

使用两台服务器每台12个核心总计24个核心并发运行WRF应用,服务器之间GRT网卡RoCEv2模式直连。

[root@Server1 em_real]# time /usr/mpi/gcc/openmpi-4.1.5a1/bin/mpirun -np 24 -oversubscribe --allow-run-as-root \
--host 100.0.1.10,100.0.1.11  ./wrf.exe

5.2.2 LAMMPS

使用两台服务器每台12个核心总计24个核心并发运行LAMMPS应用,服务器之间GRT网卡RoCEv2模式直连。

[root@Server1 ~]# cd ~/lammps/lammps-stable_3Mar2020/examples/shear
[root@server1 ~]# time /usr/mpi/gcc/openmpi-4.1.5a1/bin/mpirun --allow-run-as-root -np 24 –oversubscribe \
--host 100.0.1.10,100.0.1.11 lmp_mpi \
< /root/lammps/lammps-3Mar20/examples/shear/in.shear

6 Femrice国产100G RoCEv2网卡

6.1 E2E转发测试

配置网卡工作模式RoCEv2,使用ib_read_lat和ib_read_bw工具在服务器Server1上建立发包服务端,在Server2上建立发包客户端,测试GRT网卡直连情况下的带宽和时延。

6.1.1 基础配置

[root@Server ~]# rmmod irdma
[root@Server ~]# modprobe irdma roce_ena=1
[root@Server ~]# ibv_devices
    device          	   node GUID
    ------          	----------------
    rdmap3s0f0      	5a53c0fffe7608ea
rdmap3s0f1      	5a53c0fffe7608eb 
[root@Server ~]# ibv_devinfo rdmap3s0f0
命令行
[root@Server1 ~]# ifconfig ens1f1 100.0.2.10 up
[root@Server2 ~]# ifconfig ens1f1 100.0.2.11 up

6.1.2 GRT网卡直连

[root@Server1 ~]# ib_read_lat -R -d rdmap2s0f0 -F --report_gbits -a
[root@Server2 ~]# ib_read_lat -a -R -x 5 -d rdmap3s0f0 -F -f 2 100.0.2.10
[root@Server1 ~]# ib_read_bw -R -d rdmap2s0f0 -F --report_gbits -a
[root@Server2 ~]# ib_read_bw -a -R -x 5 -d rdmap3s0f0 -F -f 2 100.0.2.10

6.2 HPC应用测试

在两台服务器上使用WRF开源气象模拟软件和LAMMPS高分子计算软件进行数据测试,测试Femrice国产网卡完成并行计算运行所需时间。

6.2.1 LAMMPS

使用两台服务器每台12个核心总计24个核心并发运行LAMMPS应用,服务器之间Femrice网卡RoCEv2模式直连。

[root@Server1 ~]# cd ~/lammps/lammps-stable_3Mar2020/examples/shear
[root@server1 ~]# mpirun --allow-run-as-root -np 24 –oversubscribe \
-host 100.0.1.10,100.0.1.11 lmp_mpi \
< /root/lammps/lammps-3Mar20/examples/shear/in.shear

6.2.2 WRF

使用两台服务器每台12个核心总计24个核心并发运行WRF应用,服务器之间Fmerice网卡RoCEv2模式直连。

[root@Server1 em_real]# time /usr/mpi/gcc/openmpi-4.1.5a1/bin/mpirun -np 24 -oversubscribe --allow-run-as-root \
--host 100.0.1.10,100.0.1.11  ./wrf.exe

7 测试结果

7.1 E2E转发测试

本次E2E场景测试方案,测试结果如图3、图4所示:
Mellanox X-4 100G网卡,网卡时延1.74us。
Femrice Intel E810-C网卡,带宽4723.19MB/s,网卡时延8.59us。
GRT Intel E810-C网卡带宽4794.26MB/s,网卡时延9.02us。

国产网卡时延数据

图3:国产网卡时延数据

国产网卡带宽数据

图4:国产网卡带宽数据

7.2 HPC应用测试

本次HPC应用WRF和LAMMPS测试方案经过多次测试,测试结果3款网卡通过相同应用配置并行计算,国产100G网卡性能低约10%。

CX-N和IB交换机跑HPC应用时间

图5:CX-N和IB交换机跑HPC应用时间

更多相关文章:

CX102S-DPU开放智能网关用户指导手册

CX102S-DPU开放智能网关用户指导手册

1 引言

CX102S-DPU开放智能网关内部核心模块为1*交换芯片+2*DPU(高性能计算单元),其中两张DPU和交换芯片通过内部2*10G链路互联,其中面板的1-8接口还支持PoE++供电能力,交换芯片中运行着基于SONiC的开放的网络操作系统AsterNOS,提供丰富的L2/L3转发功能。默认情况下,DPU1默认安装了OpenWrt系统,专为网络出口提供网关能力。DPU2默认安装了Debian系统,用户可以根据实际业务需求,按需安装多种类型的软件工具。

同时,允许用户在设备的两张DPU上安装任意Linux发行版本,包括Ubuntu、Debian、OpenWRT、CentOS 等,从而支持开放的软件生态,如VPP、UFW、OpenVPN、Snort、HAProxy、Nginx、ntopng等,并可根据用户需要在同一台设备上组合运行多个软件。

智能、网关、OpenWr
CX102S-DPU开放智能网关

2 首次登录设备

2.1 设备基础配置

设备初始化情况下没有默认的登录/管理IP,设备上电后需要通过串口连接,配置IP地址后可以通过SSH的方式登录设备。

  • 设备默认登录用户名:admin,密码:asteros。
  • 通过串口连接设备时需注意修改波特率为:115200。

该设备内置两张高性能DPU卡,其中DPU1通过内部接口Ethernet19与交换芯片相连,DPU2通过内部接口Ethernet20与交换芯片相连。缺省情况下,设备面板上的所有物理接口以及内部接口都为access模式,默认均为VLAN1,登录设备后可以通过给VLAN1配置IP地址作为设备的管理IP。

设备面板上的所有物理接口以及内部接口都为access模式

设备配置命令如下:

3 配置DPU1

DPU1默认安装了OpenWrt系统,专为网络出口提供网关能力,用户也可以基于该系统安装第三方软件。如需自定义安装其他基础操作系统,请前往Asterfusion官网参考《CX102S-DPU开放智能网关DPU操作系统安装指导》进行系统安装。

需要将连接设备的PC地址配置为同一网段
登录openwrt哇、网关

注:如需修改DPU1/DPU2的默认IP地址,请通过串口连接设备后,在命令行输入以下命令分别可以进入DPU1和DPU2后台进行配置修改:(注:命令需一次性完整输入)

3.2 OpenWrt功能配置

3.2.1 配置WAN接口

缺省情况下,OpenWrt默认的LAN接口状态如下图所示,需先创建一个WAN口接入运营商网络:

OpenWrt默认的LAN接口状态

按照以下步骤创建接口,需要注意设备侧需要对应配置相同的VLAN才能互通(以下步骤中LAN端口为VLAN10,WAN端口为VLAN100,用户可根据网络情况进行修改)
1、点击【网络】-【接口】-【设备】-【添加设备配置】

添加设备配置

2、配置以下参数信息,点击【保存】

配置以下参数信息

3、删除IPV6默认配置后点击【保存并应用】

删除IPV6默认配置

4、再返回到【接口】,点击【添加新接口】

再返回到【接口】

5、配置以下参数信息后点击【创建接口】

配置参数信息

6、点击【创建接口后】,根据网络出口真实的IP规划进行配置后点击【保存】

根据真实的IP规划进行配置

7、WAN接口配置完成后点击【保存并应用】,完成接口的配置

完成接口的配置

3.2.2 配置LAN接口

1、点击【网络】-【接口】-【设备】-【添加设备配置】

添加设备配置

2、配置以下参数信息,点击【保存】

配置参数信息

3、再返回到【接口】,点击【添加新接口】

添加新接口

4、点击【创建接口后】,根据网络LAN真实的IP规划进行配置后点击【保存】

根据网络LAN真实的IP规划进行配置
根据网络LAN真实的IP规划进行配置

5、将初始的LAN口删除后点击【保存并应用】,即可完成OpenWrt的配置

完成OpenWrt的配置

注:如需配置其他功能,详情请参考OpenWrt官方配置指导手册

3.3 设备接口配置

典型场景配置

典型场景配置举例:当图中PC需要经过网关设备访问外网时,需要把OpenWrt中eth0.100接口设置为WAN口,eth0.10接口设置成LAN口(上一节配置中已介绍),同时需要把设备的Eth18口与运营商专线连接,配置为WAN端口,把设备的Eth1-4口连接PC,配置成LAN端口,VLAN(WAN:VLAN100,LAN:VLAN10),DPU1与交换机侧通过Ethernet19口进行数据传输。将交换机的内部接口Eth19的VLAN放行,设备配置如下:

4 配置DPU2

DPU2默认安装了Debian系统,用户也可以基于该系统安装其他第三方软件。该文档以在系统之上安装ntopng(监控网络流量工具)举例,可以将网络出口的全流量进行可视化监控分析,用户如需自定义安装其他基础操作系统,请前往Asterfusion官网参考《CX102S-DPU开放智能网关-DPU操作系统安装指导》进行系统安装,如需自定义安装其他软件工具,请前往Asterfusion官网参考《CX102S-DPU开放智能网关-DPU软件安装指导-ntopng》进行系统安装。

4.1 安装依赖

4.2 准备源码

4.3 编译安装

4.4 交换机侧配置

DPU2与交换机侧通过Ethernet20口进行数据传输,此时需要把交换机上WAN侧(Ethernet 16)的流量镜像到Ethernet20,供DPU2上的ntopng进行监控分析。

4.5 功能验证

当前ntopng所在计算单元的管理IP是192.168.2.1/24,PC配置相同网段的IP,与设备Ethernet1口连接,通过192.168.2.1:3000即可访问ntopngp的WEB界面。默认的用户名密码是admin/admin,第一次登录需要修改密码。

登录界面

在Web页面上可以看到所有经过WAN口的全部流量:

Web页面上可以看到所有经过WAN口的全部流量

相关产品:云化园区交换机

相关阅读:

DPU软件安装指导-ntopng

在Debian Linux上安装ntopng

DPU软件安装指导-ntopng

本文档介绍如何在星融元CX102S-DPU设备的计算单元(DPU)的Debian Linux系统上安装网络流量可视化监控工具ntopng

1、ntopng介绍

ntopng是ntop的下一代版本,是一款基于web的网络流量分析工具,它能够实时监控和分析网络流量,提供丰富的可视化界面,帮助用户更好地了解网络状况和优化网络性能。

ntopng支持多种协议和数据源,包括TCP、UDP、HTTP、DNS、NetFlow等,可以对网络流量进行深度分析,并提供实时警报和日志记录功能。ntopng的优点是易于安装和使用,具有强大的功能和灵活的配置选项,可以帮助管理员快速识别网络问题并采取相应措施。

ntopng支持多种协议和数据源

2、 ntopng编译安装

2.1 安装依赖

2.2 准备源码

3.3 编译安装

3、启动运行

计算单元-1侧配置步骤:

       默认情况下,计算单元-1预装OpenWRT系统,可根据用户所处网络环境到OpenWRT的WEB界面进行相应的网络配置。具体配置方法/流程请参考OpenWRT的指导文档。

计算单元-2侧配置步骤:

计算单元-1侧配置步骤
交换单元侧配置
交换单元侧配置

5 访问验证ntopng运行

当前ntopng所在计算单元的管理IP是192.168.17.26/24,所以通过 http://192.168.17.26:3000 访问ntopngp的WEB界面。默认的用户名密码是admin/admin,第一次登录需要修改密码。

ntopng
流量仪表盘
流量仪表盘
系统状态概览
系统状态概览

相关产品:CX-M系列云化园区交换机

JumpServer-开源堡垒机的部署

JumpServer-开源堡垒机的部署

1 JumpServer简介

Jumpserver 是全球首款完全开源的堡垒机,使用 GNU GPL v2.0 开源协议,是符合 4A 机制的运维安全审计系统。

Jumpserver 使用 Python / Django 进行开发,遵循 Web 2.0 规范,配备了业界领先的 Web Terminal 方案,交互界面美观、用户体验好。

Jumpserver 采纳分布式架构,支持多机房跨区域部署,支持横向扩展,无资产数量及并发限制。

2 目标

使用Jumpserver统一管理公司内网资源,可以实现不通过内网来访问公司Windows/Linux资源。

3 环境准备

一台server,操作系统CentOS 7.4.1708 镜像CentOS-7-x86_64-DVD-1810.iso,IP 192.168.5.135,服务器具体配置如下:

  • 硬件配置:2个CPU核心, 4G 内存, 50G 硬盘(最低)
  • Python = 3.6.x

4 组件说明

  • JumpServer 为管理后台, 管理员可以通过 Web 页面进行资产管理、用户管理、资产授权等操作, 用户可以通过 Web 页面进行资产登录, 文件管理等操作
  • Koko 为 SSH Server 和 Web Terminal Server 。用户可以使用自己的账户通过 SSH 或者 Web Terminal 访问 SSH 协议和 Telnet 协议资产
  • Luna 为 Web Terminal Server 前端页面, 用户使用 Web Terminal 方式登录所需要的组件
  • Guacamole 为 RDP 协议和 VNC 协议资产组件, 用户可以通过 Web Terminal 来连接 RDP 协议和 VNC 协议资产 (暂时只能通过 Web Terminal 来访问)

5 端口说明

  • JumpServer 默认 Web 端口为 8080/tcp, 默认 WS 端口为 8070/tcp
  • Koko 默认 SSH 端口为 2222/tcp
  • Guacamole 默认端口为 8081/tcp,
  • Nginx 默认端口为 80/tcp
  • Redis 默认端口为 6379/tcp
  • Mysql 默认端口为 3306/tcp

6 部署过程

6.1 关闭SELinux

SELinux不关闭的情况下会发生无法访问的问题。

[root@localhost  ~]# setenforce 0
[root@localhost  ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux

6.2 关闭防火墙

防止安装时出现各个组件的端口不能访问的问题。

[root@localhost  ~]#systemctl stop firewalld && systemctl dible firewalld

6.3 安装依赖包

[root@localhost  ~]# yum -y install wget gcc epel-release git

6.4 安装Redis

JumpServer使用Redis做cache和celery broke。

[root@localhost  ~]# yum -y install redis
[root@localhost  ~]# systemctl enable redis
[root@localhost  ~]# systemctl start redis

6.5 安装Mysql并授权

JumpServer使用Mysql做数据库,也支持Sqlite3,Postgres等。

[root@localhost  ~]# yum -y mariadb mairadb-devel mariadb-server
[root@localhost  ~]# systemctl enable mairadb
[root@localhost  ~]# systemctl start mariadb
[root@localhost  ~]# mysql -uroot -e "create database jumpserver default charset 'utf8'; grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'tera123'; flush privileges;"

6.6 Mysql修改存储路径

Mysql yum安装后默认存储路径为根目录,所以需要修改存储路径防止根目录磁盘被占满。

[root@localhost  ~]# vi /etc/my.cnf.d/mariadb-server.cnf
[mysqld]
datadir=/home/mysql
socket=/home/mysql/mysql.sock
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
[root@localhost  ~]# vi /etc/my.cnf.d/client.cnf 
[client-mariadb]
socket=/home/mysql/mysql.sock
[root@localhost  ~]# systemctl restart mariadb

6.7 安装Nginx

安装Nginx,反向代理JumpServer各个组件。

[root@localhost  ~]#vi /etc/yum.repos.d/nginx.rep
[nginx]
name=nginx 
repobaseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
[root@localhost  ~]# yum -y install nginx
[root@localhost  ~]# systemctl enable nginx

6.8 安装Pyhon3.6

[root@localhost  ~]# yum -y install python36 python36-devel
[root@localhost  ~]# cd /home
[root@localhost  ~]# python3.6 -m venv py3
[root@localhost  ~]# source /home/py3/bin/activate

6.9 安装JumpServer

[root@localhost  ~]# cd /home
[root@localhost  ~]# git clone --depth=1 https://github.com/jumpserver/jumpserver.git
[root@localhost  ~]# yum -y install $(cat /home/jumpserver/requirements/rpm_requirements.txt)

6.10 安装Python依赖库

[root@localhost  ~]# pip install wheel
[root@localhost  ~]# pip install --upgrade pip setuptools
[root@localhost  ~]# pip install -r /home/jumpserver/requirements/requirements.txt

6.11 修改JumpServer配置文件

[root@localhost  ~]# cd /home/jumpserver
[root@localhost  ~]# cp config_example.yml config.yml
[root@localhost  ~]# vi config.yml
SECRET_KEY: FjAvZ0D5c6LwaUJVb7AwPPsiFl2wVVpMGQl41LBbQKi23bPEiK
BOOTSTRAP_TOKEN: e7t4EZ0BBw5GfvlH
DEBUG: false
LOG_LEVEL: ERROR
SESSION_EXPIRE_AT_BROWSER_CLOSE: true
DB_ENGINE: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_USER: jumpserver
DB_PASSWORD: tera123
DB_NAME: jumpserver
HTTP_BIND_HOST: 0.0.0.0
HTTP_LISTEN_PORT: 8080
WS_LISTEN_PORT: 8070
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379

6.12 运行JumpServer

[root@localhost  ~]# cd /home/jumpserver
[root@localhost  ~]# ./jms start all -d

6.13 安装Docker

[root@localhost  ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@localhost~  ] # yum-config-manager\
--add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@localhost  ~]# yum -y install docker-ce wget
[root@localhost  ~]# mkdir /etc/docker
[root@localhost  ~] #yum -y install docker-ce wget
[root@localhost  ~] #systemctl enable docker
[root@localhost  ~] #systemctl start docker

6.14 部署Koko与Guacamole

[root@localhost  ~]# docker run --name jms_koko -d -p 2222:2222\
-p 127.0.0.1:5000:5000\
-e CORE_HOST=http://192.168.5.135:8080\
-e BOOTSTRAP_TOKEN=e7t4EZ0BBw5GfvlH \
--restart=always wojiushixiaobai/jms_koko:1.5.6
[root@localhost  ~]# docker run --name jms_guacamole -d -p 127.0.0.1:8081:8080\
-e JUMPSERVER_SERVER=http://192.168.5.135:8080\ 
-e BOOTSTRAP_TOKEN=e7t4EZ0BBw5GfvlH\ 
--restart=always wojiushixiaobai/jms_guacamole:1.5.6

6.15 部署Luna

Luna为JumpServer的Web前端。

[root@localhost  ~]# cd /home
[root@localhost  ~]# wget https://demo.jumpserver.org/download/luna/1.5.6/luna.tar.gz
[root@localhost  ~]# tar -xvf luna.tar.gz
[root@localhost  ~]# chown -R root:root luna 

6.16 配置Nginx

[root@localhost  ~]# vi /etc/nginx/conf.d/default.conf
server {
    listen 80;
    # server_name _;
    client_max_body_size 1000m;  # 录像及文件上传大小限制
    client_header_timeout 360s;
    large_client_header_buffers 4 16k;
    client_body_buffer_size 128k;
    proxy_connect_timeout 600;
    proxy_read_timeout 600;
    proxy_send_timeout 600;

    location /luna/ {
        try_files $uri / /index.html;
        alias /home/luna/;  # luna 路径, 如果修改安装目录, 此处需要修改
    }
    location /media/ {
        add_header Content-Encoding gzip;
        root /home/jumpserver/data/;  # 录像位置, 如果修改安装目录, 此处需要修改
    }

    location /static/ {
        root /home/jumpserver/data/;  # 静态资源, 如果修改安装目录, 此处需要修改
    }

    location /koko/ {
        proxy_pass       http://localhost:5000;
        proxy_buffering off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        access_log off;
    }

    location /guacamole/ {
        proxy_pass       http://localhost:8081/;
        proxy_buffering off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $http_connection;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        access_log off;
    }

    location /ws/ {
        proxy_pass http://localhost:8070;
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        access_log off;
    }

    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        access_log off;
    }
}
[root@localhost  ~]# systemctl start nginx

6.17 端口检查

检查端口状态,必须有6379,8080,8081,80,5555,8070,3306,2222几个端口。

[root@localhost  ~]# netstat -nlp |grep tcp

6.18 验证JumpServer

默认登录密码,admin:admin,登录成功有欢迎界面,此次部署即成功。

[root@localhost  ~]# ssh -p2222 admin@192.168.5.135

7 参考资料

  1. JumpServer官网:http://www.jumpserver.org/
  2. JumpServer文档:https://jumpserver.readthedocs.io/zh/master/

相关阅读。

如有其它问题,请填写右侧需求表单联系我们。

Mellanox网卡驱动安装

Mellanox网卡驱动安装

1 目标

本文档以CentOS7.6为例,详细介绍了Mellanox网卡MLNX_OFED的驱动安装和固件升级方法。

2 下载驱动

该方法适用于CentOS、RHEL、SLES、Ubuntu、EulerOS等操作系统,在安装不同操作系统的驱动时,请下载对应操作系统版本的驱动。

首先根据系统发行版本下载对应的驱动,下载地址如下:https://www.mellanox.com/page/products_dyn?product_family=26&mtag=linux_sw_drivers&ssn=q80crdrodvb8ce021n94ep58f1

注意选择download,根据相应的版本选择相应的驱动,点击后要同意协议再下载。

根据不同操作系统,选择相对应的安装驱动
图1
选好安装驱动后,同意协议
图2

本次下载的驱动版本为:MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64.tgz

3 安装步骤

3.1 把下载好的Mellanox驱动解压缩

[root@localhost ~]# tar –zxvf MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64.tgz
[root@localhost ~]# cd MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64

3.2 查看当前系统的内核版本

[root@localhost MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64]# uname -r
3.10.0-957.el7.x86_64

3.3 查看当前驱动所支持的内核版本

[root@localhost MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64]# cat .supported_kernels 
3.10.0-957.el7.x86_64 

注:由以上可知下载的默认驱动支持当前的内核版本

3.4 如果当前内核与支持内核不匹配

手动编译适合内核的驱动,在编译之前首先安装gcc编译环境和kernel开发包

[root@localhost MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64]#yum  install gcc gcc-c++
libstdc++-devel kernel-default-devel 

添加针对当前内核版本的驱动

[root@localhost MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64]#./mlnx_add_kernel_support.sh -m /root/MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64  -v

注:完成后生成的驱动文件在/tmp目录下

[root@localhost MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64]# ls -l /tmp/MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64-ext.tgz
-rw-r--r-- 1 root root 282193833 Dec 23 09:49 /tmp/MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64-ext.tgz

3.5 安装驱动

[root@localhost tmp]# tar xzvf MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64-ext.tgz
[root@localhost tmp]# cd MLNX_OFED_LINUX-4.7-3.2.9.0-rhel7.6-x86_64-ext
[root@localhost tmp]# ./mlnxofedinstall

3.6 最后启动openibd服务

[root@localhost ~]#/etc/init.d/openibd start
[root@localhost ~]#chkconfig openibd on

4 结论

Mellanox网卡驱动安装主要根据内核是否匹配分为下载后直接安装和编译安装两部分。

5 参考资料

  1. Mellanox官网:https://www.mellanox.com

点击了解Asterfusion CX-N数据中心交换机

如有其它问题,请填写右侧需求表单联系我们。

OTP动态口令部署验证方案

OTP动态口令部署验证方案

1 OTP简介

OTP:One-Time Password Algorithm又称一次性密码,是使用密码技术实现的在客户端和服务器之间通过共享秘密的一种认证技术,是一种强认证技术,是增强目前静态口令认证的一种非常方便技术手段,是一种重要的双因素认证技术,动态口令认证技术包括客户端用于生成口令产生器的,动态令牌,是一个硬件设备,和用于管理令牌及口令认证的后台动态口令认证系统组成。

2 OTP三种实现方式

OTP从技术上分为三种形实现式:时间同步、事件同步、挑战应答。

  • 时间同步:原理是基于动态令牌动态口令验证服务器的时间比对,基于 时间同步的 令牌,一般每60秒产生一个新口令,要求服务器能够十分精确的保持正确的时钟,同时对其令牌的晶振频率有严格的要求,这种技术对应的终端是硬件令牌。
  • 事件同步:基于事件同步的令牌,其原理是通过某一特定的事件次序及相同的种子值作为输入,通过HASH算法中运算出一致的密码。
  • 挑战应答:常用于的网上业务,在网站上输入下发的挑战码,动态令牌输入该挑战码,通过内置的算法上生成一个6/8位的随机数字,口令一次有效,这种技术目前应用最为普遍,包括刮刮卡、短信密码、动态令牌也有挑战/应答形式。

3 基于时间的OTP动态口令

使用阿里云身份证宝或者Google Authenticator谷歌动态口令验证器可以实现基于时间的OTP动态口令。是一种基于时间同步的OTP计算方式,是通过客户端和服务器持有相同的密钥并基于时间基数,服务端和客户端采用相同的Hash算法,计算出长度为六位的验证码。当客户端和服务端计算出的验证码相同,则验证通过。

4 CenOS部署

在CentOS上安装Google身份验证器服务器端组件,安装之前需要启用EPEL库。

4.1 启用EPEL库

[root@TOTP  ~]# wget \
https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm
[root@TOTP  ~]# rpm -ivh epel-release-7-14.noarch.rpm
[root@TOTP  ~]# yum clean all && yum makecache
[root@TOTP  ~]# yum repolist
命令行展示

4.2 安装服务器端组件

服务器端安装组件可以通过yum安装和编译安装两种方式实现。

yum安装:
[root@TOTP  ~]# yum install google-authenticator
编译安装:
[root@TOTP  ~]# git clone https://github.com/google/google-authenticator.git
[root@TOTP  ~]# cd google-authenticator/libpam/
[root@TOTP  ~]# ./bootstrap.sh
[root@TOTP  ~]# ./configure
[root@TOTP  ~]# make && make install
[root@TOTP  ~]# cp .libs/pam_google_authenticator.so /lib64/security/

4.3 修改配置文件

安装完成之后添加谷歌身份验证器PAM模块,并且配置密码认证。

[root@TOTP  ~]# echo "auth required pam_google_authenticator.so nullok" >>/etc/pam.d/sshd
[root@TOTP  ~]# cat /etc/pam.d/sshd
命令行展示
[root@TOTP  ~]# vi /etc/ssh/sshd_config
ChallengeResponseAuthentication yes
[root@TOTP  ~]# systemctl restart sshd

5 Ubuntu部署

在Ubuntu上安装Google身份验证器服务器端组件。

5.1 安装服务器端组件

服务器端安装组件可以通过apt安装和编译安装两种方式实现。

apt安装:
[root@TOTP  ~]# apt-get install libpam-google-authenticator
编译安装:
[root@TOTP  ~]# git clone https://github.com/google/google-authenticator.git
[root@TOTP  ~]# cd google-authenticator/libpam/
[root@TOTP  ~]# ./bootstrap.sh
[root@TOTP  ~]# ./configure
[root@TOTP  ~]# make && make install
[root@TOTP  ~]# cp .libs/pam_google_authenticator.so /lib64/security/

5.2 修改配置文件

安装完成之后添加谷歌身份验证器PAM模块,并且配置密码认证。

[root@TOTP  ~]# echo "auth required pam_google_authenticator.so" >>/etc/pam.d/sshd
[root@TOTP  ~]# cat /etc/pam.d/sshd
命令行展示
[root@TOTP  ~]# vi /etc/ssh/sshd_config
ChallengeResponseAuthentication yes
[root@TOTP  ~]# /etc/init.d/ssh restart

6 配置认证信息

手机安装google authenticator,在软件中扫描服务器二维码,或者手动添加生成的密钥。配置认证信息。生成的一次性验证码可临时使用。

6.1 生成密钥

生成密钥,并保存输出的二维码和密钥信息,以及一次性密钥。

[root@TOTP  ~]# google-authenticator
Your new secret key is: MNYOJT7NJ5NGE5WPT3CDRJ5XOI
Your verification code is 840082
Your emergency scratch codes are:
  77957928
  71596997
  46394232
  61882336
  25041580

6.2 配置认证信息

使用手机软件google authenticator,扫描服务器二维码,生成服务器6位验证码。

认证信息

6.3 登录服务器

登录服务器选择Keyboard Interactive登录。

登录框

输入密码和6位验证码后,登录成功。

验证身份

7 参考资料

如有其它问题,请填写右侧需求表单联系我们。www.asterfusion.com

更多产品信息:AsterNOS

AsterNOS监控方案

1 AsterNOS监控方案

1.1 方案概述

本文档将简要介绍AsterNOS监控方案及其各组件功能,并完成对Asterfusion CX-N系列超低时延云交换机的配置和数据采集。

1.2 整体逻辑方案图

AsterNOS监控方案逻辑图
图1:AsterNOS监控方案逻辑图

1.3 各组件功能

  • Alertmanager:主要用于接收Prometheus发送的告警信息,并及时地将告警信息发送到PrometheusAlert进行转发。
  • PrometheusAlert:运营告警中心消息转发系统,支持主流的监控系统Prometheus以及所有支持WebHook接口的系统发出的预警信息,支持将收到的信息通过WeChat、Mail、飞书、短信等渠道推送。
  • Grafana:是一个开源的监控数据分析和可视化套件,最常用于对基础设施和应用数据分析的时间序列数据进行可视化分析。
  • Prometheus:Prometheus是一个开源的系统监控和报警系统,同时支持多种Exporter采集数据,Prometheus性能足够支撑上万台规模的集群。
  • SNMP Exporter:通过SNMP协议中用不同的OID区分不同的状态数据,OID非常类似于Prometheus中的指标的概念,SNMP Exporter通过从Agent查询指定的OID数据,同时将数据映射到可读的指标上,实现SNMP数据到Prometheus指标的转换,大部分场景下用户无需额外配置即可将OID转换为可读的指标数据。
  • Node Exporter:多用于收集内核公开的硬件或操作系统指标,监控设备的CPU、内存、磁盘、I/O等信息。

2 组网方案

2.1 软硬件信息

名称版本备注
监控节点CPU:48 Cores
内存:128 GB
Prometheus、Alertmanager Grafana
服务器系统CentOS Linux release 7.9.2009 (Core) 
AsterNOSAsterNOS Version 3.1 R0402P02 
Prometheusprom/prometheus:v2.37.0 
Alertmanagerquay.io/prometheus/alertmanager 
Grafanagrafana/grafana-oss:9.0.6 
Node ExporterNode Exporter:v0.3.0SONiC Node Exporter
SNMP ExporterSNMP Exporter:0.24.1 
表1:软硬件版本信息

2.2 监控系统规划

主机名节点IP节点角色
监控节点管理口:10.240.5.223
Promehteus:9090 Alertmanager:9093 Grafana:3000 PrometheusAlert:8080
Prometheus、Alertmanager、Grafana、PrometheusAlert
AsterNOS管理口:10.230.1.10 Node Exporter:9100 SNMP Exporter:9116Node Exporter、SNMP Exporter
表2:监控规划

3 监控组件部署

3.1 Node Exporter

在每台被监控交换机上部署Node Exporter,用于收集内核公开的硬件或操作系统指标,监控交换机的CPU、内存、磁盘、I/O等信息。Node Exporter监听本地9100端口。

root@sonic:~# version=$(curl -s https://api.github.com/repos/kamelnetworks/sonic_exporter/releases | jq '.[0].name' -r)
root@sonic:~# sonic-package-manager install   \
--from-repository "ghcr.io/kamelnetworks/sonic_exporter:${version}" \
--enable
root@sonic:~# config feature state sonic_exporter enabled
root@sonic:~# config sonic-exporter port 9100
root@sonic:~# netstat -nlp |grep 9100
部署Node Exporter
Docker方式安装:
root@sonic:~# docker run -d  --net=host \
-v /run/redis/:/var/run/redis/ \
--name roce_exporter sonic_exporter:0.3.0

3.1.1 Node Exporter Metrics

浏览器访问设备的9100端口,查看采集的数据。

查看采集的数据
图2:Node Exporter采集数据

3.1.2 Node Exporter 自定义监控

通过Node Exporter的Textfile插件完成自定义监控,自定义脚本并把内容以Key:value的方式写入以.prom结尾的文件,定时任务执行自定义脚本,添加启动参数,Node Exporter采集数据。

root@sonic:~# ./node_exporter \
--collector.textfile.directory='/home/admin/Prometheus/’
root@sonic:~# cat /home/admin/Prometheus/asternos.prom
#HELP example_metric read from /path/example.prom  
#TYPE example_metric guage  
example_metric 1

3.2 SNMP Exporter数据转换

在每台被监控交换机上部署SNMP Exporter,SNMP Exporter通过Agent查询指定的OID数据,同时将数据映射到可读的指标上,实现SNMP数据到Prometheus指标的转换,完成监控私有数据开发。SNMP Exporter监听本地9116端口。SNMP Exporter文件下载地址:https://github.com/prometheus/snmp_exporter/releases/download/v0.24.1/snmp_exporter-0.24.1.freebsd-amd64.tar.gz

SNMP完整配置文件:

snmp.yml
root@sonic:~# tar -xvf snmp_exporter-0.24.1.linux-amd64.tar.gz
root@sonic:~# cd snmp_exporter-0.24.1.linux-amd64
root@sonic:~/snmp_exporter-0.24.1.linux-amd64# cat snmp.yml
auths:
  public_v2:
    community: public
    security_level: noAuthNoPriv
    auth_protocol: MD5
    priv_protocol: DES
    version: 2
modules:
  AsterNOS:
    walk:
    - 1.3.6.1.2.1.2
    - 1.3.6.1.2.1.31.1.1
    get:
    - 1.3.6.1.2.1.1.1.0
    metrics:
    - name: asterSysRunTime
      oid: 1.3.6.1.4.1.56928.25.1.1
      type: gauge
      help: AsterNOS CX-N switch Device operating time
    - name: asterPortHighSpeed
      oid: 1.3.6.1.2.1.31.1.1.1.15
      type: gauge
      help: AsterNOS CX-N Port negotiation Speed
      indexes:
      - labelname: asterPortIndex
        type: gauge
      lookups:
      - labels:
        - asterPortIndex
        labelname: asterPortAlias
        oid: 1.3.6.1.2.1.31.1.1.1.18
        type: DisplayString
      - labels:
        - asterPortIndex
        labelname: asterPortDescr
        oid: 1.3.6.1.2.1.2.2.1.2
        type: DisplayString

root@sonic:~/snmp_exporter-0.24.1.linux-amd64# ./snmp_exporter &

3.2.1 SNMP Exporter Metrics

浏览器访问设备的9116端口,查看采集的数据。Moudle:AsterNOS。

图3:SNMP Exporter采集数据

3.2.2 SNMP Exporter Metrics(Docker)

Docker方式安装SNMP Exporter

snmp.tar
root@sonic:~# docker load < snmp.tar
root@sonic:~# docker run -d \
-v /home/admin/snmp.yml:/etc/snmp_exporter/snmp.yml \ 
--net=host --name snmp_exporter prom/snmp-exporter:v0.24.1

3.3 监控报警推送

3.3.1 Alertmanager

在监控节点部署Alertmanager,主要用于接收Prometheus发送的告警信息,并及时地将告警转发到ProtmetheusAlert。

[root@computer1 prometheus] docker run --name alertmanager \
-v ~/prometheus/alertmanager.yml:/etc/alertmanager/alertmanager.yml \
-d -p 0.0.0.0:9093:9093 quay.io/prometheus/alertmanager
[root@computer1 prometheus] cat alertmanager.yml
route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 5m
  repeat_interval: 1h
  receiver: 'web.hook'
receivers:
  - name: 'web.hook'
    webhook_configs:
      - url: 'http://127.0.0.1:5001/'
inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
equal: ['alertname', 'dev', 'instance']

3.3.2 PrometheusAlert

在监控节点部署PrometheusAlert,主要用于接收Alertmanager转发的告警信息,并及时地通过WeChat、Email、飞书和短信等渠道发送告警通知。

[root@computer1 prometheus] docker run -d -p 8080:8080 -v \ ~/prometheus/app.conf:/app/conf/app.conf \
--name prometheusalert feiyu563/prometheus-alert:latest
[root@computer1 prometheus] cat app.conf
appname = PrometheusAlert
#登录用户名
login_user=root
#登录密码
login_password=tera123
#监听地址
httpaddr = "0.0.0.0"
#监听端口
httpport = 8080
runmode = dev
#开启JSON请求
copyrequestbody = true
#告警消息标题
title=PrometheusAlert
#日志文件路径
logpath=logs/prometheusalertcenter.log

3.3.3 对接Email报警

[root@computer1 prometheus]# cat alertmanager.yml 
route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 5m
  repeat_interval: 1h
  receiver: 'AlertManager_Email'
receivers:
- name: 'AlertManager_Email'
  webhook_configs:
  - url: 'http://10.240.5.223:8080/prometheusalert?type=email&tpl=prometheus-email&email='
    send_resolved: true
inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
equal: ['alertname', 'dev', 'instance']

[root@computer1 prometheus]# cat app.conf
#---------------------↓邮件配置-----------------------
#是否开启邮件
open-email=1
#邮件发件服务器地址
Email_host=smtp.qq.com
#邮件发件服务器端口
Email_port=465
#邮件帐号
Email_user=
#邮件密码
Email_password=
#邮件标题
Email_title=AsterNOS告警
#默认发送邮箱
Default_emails=
 

报警信息:

AsterNos告警

3.3.4 对接飞书报警

[root@computer1 prometheus]# cat alertmanager.yml 
route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 5m
  repeat_interval: 1h
  receiver: 'AlertManager_Feishu'
receivers:
- name: 'AlertManager_Feishu'
  webhook_configs:
  - url: 'http://10.240.5.223:8080/prometheusalert?type=fs&tpl=prometheus-fs&fsurl=https://open.feishu.cn/open-apis/bot/v2/hook/41078fb9-c716-434f-9ca4-d8ba64caa7ea'
    send_resolved: true
inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
    equal: ['alertname', 'dev', 'instance']

[root@computer1 prometheus]# cat app.conf
#---------------------↓全局配置-----------------------
appname = PrometheusAlert
#登录用户名
login_user=root
#登录密码
login_password=tera123
#监听地址
httpaddr = "0.0.0.0"
#监听端口
httpport = 8080
runmode = dev
#设置代理 proxy = http://123.123.123.123:8080
proxy =
#开启JSON请求
copyrequestbody = true
#告警消息标题
title=PrometheusAlert
#日志文件路径
logpath=logs/prometheusalertcenter.log
#是否开启飞书告警通道,可同时开始多个通道0为关闭,1为开启
open-feishu=1
#默认飞书机器人地址
fsurl=https://open.feishu.cn/open-apis/bot/v2/hook/41078fb9-c716-434f-9ca4-d8ba64caa7ea

报警信息:

Prometheus告警信息

3.4 Prometheus

在监控节点部署Prometheus,用于存储Exporter采集的数据,同时提供数据检索和报警推送等功能。

[root@computer1 prometheus] docker run -d -p 9090:9090 -v \ ~/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
--name prometheus  prom/prometheus:v2.37.0
[root@computer1 prometheus] cat prometheus.yml
scrape_configs:
  - job_name: "node-exporter"
    static_configs:
      - targets: ["10.230.1.10:9100"]
  - job_name: "snmp-exporter"
    static_configs:
      - targets:
        - 10.230.1.10
    metrics_path: /snmp
    params:
      auth: [public_v2]
      module: [AsterNOS]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 10.230.1.10:9116
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      - 10.240.5.223:9093
rule_files:
  - "AsterNOS_rules.yml"

[root@computer1 prometheus] cat AsterNOS_rules.yml
groups:
- name: "CXN_node"
  rules:
  - alert: "CPU高负载警告"
    expr: ((1-(node_memory_MemAvailable_bytes / (node_memory_MemTotal_bytes))) * 100)>90
    for: 3m
    labels:
      severity: critical
    annotations:
      summary: "实例 {{ $labels.instance }} 的CPU使用率过高"
      description: "此设备的CPU使用率已超过阈值,当前值: {{ $value }}%。此问题会导致系统中各个服务假死、断连,甚至是服务器宕机,请管理员务必及时处理!"

3.4.1 Prometheus Metrics Explorer

浏览器访问监控节点的9090端口,查看Prometheus采集到的数据。

查看Prometheus采集到的数据
图5:Prometheus数据展示

3.5 Grafana

在监控节点部署Grafana,用于对基础设施和应用数据分析的时间序列数据进行可视化分析。

[root@computer1 prometheus] docker run -d -p 3000:3000 \
--name grafana  grafana/grafana-oss:9.0.6

3.5.1 Grafana Login

浏览器访问监控节点的3000端口访问Grafana登录页面,默认用户名密码admin/admin。

Grafana登录页面
图6:Grafana登陆页面

3.5.2 配置数据源

在Grafana管理面板上添加Prometheus数据源。

Grafana管理面板
图7:Grafana添加数据源

3.5.3 监控大屏

在Grafana管理面板上导入AsterNOS监控配置文件。AsterNOS监控大屏文件:

AsterNos.json
Grafana添加Dashboard
图8:Grafana添加Dashboard
Grafana监控大屏展示
图9:Grafana监控大屏展示

CX-N零配置开局能力验证方案

1 简介

零配置部署ZTP(Zero Touch Provisioning)是指新出厂或空配置设备上电启动时采用的一种自动加载开局文件(配置文件、升级文件)的功能,实现设备的免现场配置和部署,从而降低人力成本,提升部署效率。设备支持基于DHCP协议实现的ZTP功能,通过DHCP协议Option字段附带配置文件、升级文件的地址和路径信息,实现相关开局文件的自动化获取和加载任务。

ZTP流程图

2 验证方案

2.1 功能需求

多台设备同时上线无需手动配置,设备自动从FTP服务器获取对应本台角色设备的全量配置并自动加载,设备之间建立BGP peer,完成网络设备的完整的自动上线。

2.2 组网拓扑

组网拓扑

2.3 配置步骤

(1)准备两台设备的全量配置文件:Leaf-A.json、Spine-A.json,配置中包含设备的端口IP以及BGP相关配置;

(2)同时准备引导文件ztp.json,并将配置文件和引导文件同时上传至FTP服务器的相关路径;配置文件名称以实际产品能力为准,但要具备唯一性;

(3)配置DHCP服务器的boot-file字段,指导设备获取引导文件ztp.json;

(4)完成组网拓扑连线,设备Leaf A、Spine A上电;

(5)等待10分钟,登录设备Leaf A与Spine A检查是否获取了相关配置;

(6)通过ping测试互联可达并查看BGP peer的建立情况.

2.4 预计结果

  • Leaf A和Spine A获取到对应自身序列号的配置文件
  • Ping测试可达同时建立BGP peer

相关产品:CX-N超低时延交换机

CX-N-MC-LAG三层转发功能验证

1 方案概述

本文主要讲解CX-N 系列交换机基于MC-LAG实现的三层组网下的相关解决方案,验证网络通信、故障转移和恢复等能力。整个验证过程中交换机所有命令通过思科命令行配置完成。

1.1 MC-LAG二层转发

Asterfusion CX-N超低时延云交换机支持基于MC-LAG的二层转发功能,如图1所示:

基于MC-LAG的二层转发功能
图1:基于MC-LAG的二层转发功能

在上行链路故障转移和恢复测试场景中,使用Server1生成TCP/UDP流量向Server3打流,此时流量路径为:Server1->Leaf1->Spine->Leaf3->Server3。

Leaf1交换机在上联端口HG1故障的情况下,L2流量可以通过Peer-link转发到对端Leaf2,然后通过BGP学习到下一跳为Spine,最后经过Leaf3到Server3。此时流量路径:Server1->Leaf1->Leaf2->Spine->Leaf3->Server3。

1.2 MC-LAG三层转发

Asterfusion CX-N超低时延云交换机支持基于MC-LAG的三层转发功能,相较于MC-LAG的二层转发功能,三层转发新增一条三层冗余链路用于数据转发,转发和控制分离。如图2所示:

基于MC-LAG的三层转发功能
图2:基于MC-LAG的三层转发功能

在上行链路故障转移和恢复测试场景中,使用Server1生成TCP/UDP流量向Server3打流,此时流量路径为:Server1->Leaf1->Spine->Leaf3->Server3。

Leaf1交换机在上联端口HG1故障的情况下,L3流量可以通过BGP邻居学习到Server3的路由通过三层冗余链路转发到Leaf2,然后通过BGP学习到下一跳为Spine,最后经过Leaf3到Server3。此时流量路径:Server1->Leaf1->Leaf2->Spine->Leaf3->Server3。

2 物理网络拓扑

本次相关方案验证的整体物理拓扑如图1所示:

CX-N基于MC-LAG整体物理网络拓扑
图3:CX-N基于MC-LAG整体物理网络拓扑

3 硬件与软件环境

3.1 设备管理口

验证过程中所涉及到的设备、主机名及管理网口IP地址等信息,如表1所示:

设备主机名管理口IP地址备注
CX532-NSpine110.230.1.32 
CX308-NLeaf110.230.1.18 
CX308-NLeaf210.230.1.19 
CX308-NLeaf310.230.1.20 
ServerServer110.230.1.11 
ServerServer310.230.1.13 
表1:设备管理口列表

3.2 硬件环境

验证环境中涉及到的硬件环境,如表2所示:

名称型号硬件指标数量备注
SpineCX532P-N【参见产品彩页】1 
LeafCX308P-48Y-N【参见产品彩页】3 
光模块10GSFP+6为了尽量减少物料种类,线缆和模块速率进行了统一,交换机互联使用100G模块和线缆,服务器需用10G模块和线缆
100GQSFP2810
网线//6 
光纤多模10G /25G适用3 
多模100G适用5 
服务器/内存推荐8G以上2 
表2:硬件环境

3.3 软件环境

验证环境中涉及到的软件环境,如表3所示:

名称版本备注
iperf33.1.7 
CX532-NSONiC.201911.R0314P06 
CX308-NSONiC.201911.R0314P06 
服务器系统CentOS Linux 7.8.2003 
服务器内核3.10.0-1127.18.2.el7 
表3:软件环境

4 基础环境部署

在两台Server服务器上,安装部署本次验证方案的所需要的基础软件。

补充说明:以”[root@server ~]#”为开头的命令表示两台服务器都要执行。

4.1 LLDP

在两台Server服务器上安装LLDP服务,如果是X710网卡要求网卡驱动版本大于2.3.6,然后配置网卡开启LLDP。

[root@server ~]# yum -y install epel-release
[root@server ~]# yum -y install lldpd
[root@server ~]# systemctl start lldpd
[root@server ~]# systemctl enable lldpd
[root@server ~]# lspci |grep -i ether
配置网卡开启LLDP
[root@server ~]# ethtool -i ens1f0
[root@server ~]# ethtool -i ens1f1
配置网卡开启LLDP
[root@sever ~]# ethtool --set-priv-flags ens1f0 disable-fw-lldp on
[root@sever ~]# ethtool --set-priv-flags ens1f1 disable-fw-lldp on

4.2 安装iPerf3 

在2台Server服务器上安装iPerf3软件用来打流。

在2台服务器上上执行:
[root@server ~]# yum -y install iperf3
[root@server ~]# iperf3 -v
iperf 3.1.7
Linux compute-2 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 2022 x86_64
Optional features available: CPU affinity setting, IPv6 flow label, TCP congestion algorithm setting, sendfile / zerocopy, socket pacing

4.3 检查链路连接

所有交换机设备要提前检查和Server服务器之间的链路连接情况,确保交换机设备和Server服务器之间的链路连接没有问题,以下命令在所有交换机设备上执行。

admin@sonic:~$ sudo config cli-mode cli
admin@sonic:~$ sudo sonic-cli
sonic#
Spine1# show lldp table
查看Spine1链路情况
Spine2# show lldp table
查看Spine2链路情况
Leaf1# show lldp table
查看Leaf1链路情况
Leaf2# show lldp table
查看Leaf2链路情况
Leaf3# show lldp table
查看Leaf3链路情况

5 组网环境配置   

5.1 逻辑拓扑

组网逻辑拓扑与接口配置
图4:组网逻辑拓扑与接口配置

5.2 Spine1

5.2.1 设备恢复出厂设置

配置思科命令行,恢复Spine1设备到出厂设置。

Spine1@sonic:~$ sudo config cli-mode cli
Spine1@sonic:~$ sudo sonic-cli
sonic# delete startup-config
sonic# reload

5.2.2 配置Spine1接口IP

在Spine1交换机上配置与3台Leaf交换机的互联接口IP。

Spine1# configure terminal
Spine1(config)# interface ethernet 0/0
Spine1(config-if-0/0)# ip address 10.0.10.2/24
Spine1(config-if-0/0)# interface ethernet 0/4
Spine1(config-if-0/4)# ip address 10.0.11.2/24
Spine1(config-if-0/4)# interface ethernet 0/8
Spine1(config-if-0/8)# ip address 10.0.12.2/24

5.2.3 配置Spine1的BGP

在Spine1交换机上配置3台Leaf交换机的BGP邻居。

Spine1# configure terminal
Spine1(config)# interface loopback 0
Spine1(config-loif-0)# ip address 10.10.0.3/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.3/32
Loopback ip will be used as bgp router-id in frr
Spine1(config-loif-0)# ip address 10.10.0.3/3
Spine1(config-loif-0)# router bgp 65003
Spine1(config-router)# neighbor 10.0.10.1 remote-as 65007
Spine1(config-router)# neighbor 10.0.11.1 remote-as 65007
Spine1(config-router)# neighbor 10.0.12.1 remote-as 65008
Spine1(config-router)# route-map DEFAULT_EVPN_ROUTE_MAP permit 65535
Spine1(config-route-map)# route-map FROM_BGP_PEER_V4 permit 65535
Spine1(config)# address-family ipv4 unicast
Spine1(config)# router bgp 65003
Spine1(config-router)# address-family ipv4 unicast
Spine1(config-router-af)# redistribute connected
Spine1(config-router-af)# neighbor 10.0.10.1 route-map FROM_BGP_PEER_V4 in
Spine1(config-router-af)# neighbor 10.0.10.1 route-map FROM_BGP_PEER_V4 out
Spine1(config-router-af)# neighbor 10.0.11.1 route-map FROM_BGP_PEER_V4 in
Spine1(config-router-af)# neighbor 10.0.11.1 route-map FROM_BGP_PEER_V4 out
Spine1(config-router-af)# neighbor 10.0.12.1 route-map FROM_BGP_PEER_V4 in
Spine1(config-router-af)# neighbor 10.0.12.1 route-map FROM_BGP_PEER_V4 out
Spine1(config)# write
Spine1(config)# reload

5.3 Leaf1

5.3.1 设备恢复出厂设置

恢复Leaf1设备到出厂设置。

Leaf1# delete startup-config
Leaf1# reload

5.3.2 配置Leaf1端口速率

配置Leaf1交换机的Ethernet0口速率为10G。

Leaf1# configure terminal 
Leaf1(config)# interface ethernet 0/0  
Leaf1(config-if-0/0)# speed 10000
Leaf1(config-if-0/0)# show this
!
interface ethernet 0/0
speed 10000

5.3.3 配置Leaf1接口IP

在Leaf1交换机上配置与Leaf、Spine交换机的互联接口IP以及PortChannel、VLAN信息。

Leaf1# configure terminal 
Leaf1(config)# interface ethernet 0/48
Leaf1(config-if-0/48)# ip address 10.0.10.1/24
Leaf1(config-if-0/48)# interface link-aggregation 1
Leaf1(config-lagif-1)# interface ethernet 0/0     
Leaf1(config-if-0/0)# link-aggregation-group 1
Leaf1(config-if-0/0)# vlan 10
Leaf1(config-vlan-10)# vlan 30
Leaf1(config-vlan-30)# interface ethernet 0/56
Leaf1(config-if-0/56)# ip address 10.2.1.1/24
Leaf1(config-if-0/56)# mac-address 18:17:25:37:77:00
Leaf1(config-if-0/56)# interface ethernet 0/60
Leaf1(config-if-0/60)# switchport trunk vlan 10
Leaf1(config-if-0/60)# switchport trunk vlan 30
Leaf1(config-if-0/60)# interface vlan 10
Leaf1(config-vlanif-10)# ip address 100.0.10.1/24
Leaf1(config-vlanif-10)# interface link-aggregation 1
Leaf1(config-lagif-1)# switchport access vlan 10

5.3.4 配置Leaf1的MC-LAG

在Leaf1交换机上配置与Leaf2交换机互联接口的MC-LAG。

Leaf1# configure terminal 
Leaf1(config)# vlan 30
Leaf1(config-vlan-30)# interface vlan 30
Leaf1(config-vlanif-30)# ip address 11.0.0.6/24
Leaf1(config-vlanif-30)# mclag domain 1
Leaf1(mclag-domain)# local-address 11.0.0.6   
Leaf1(mclag-domain)# peer-address 11.0.0.7
Leaf1(mclag-domain)# peer-link ethernet 0/60
Leaf1(mclag-domain)# member lag 1
Leaf1(mclag-domain)# commit
Leaf1(mclag-domain)# interface vlan 10
Leaf1(config-vlanif-10)# mac-address 18:17:25:37:64:40

5.3.5 配置Leaf1的BGP

在Leaf1交换机上配置与Spine1交换机的BGP邻居。

Leaf1# configure terminal 
Leaf1(config)# router bgp 65007
Leaf1(config-router)# bgp router-id 10.10.0.6
Leaf1(config-router)# interface loopback 0
Leaf1(config-loif-0)# ip address 10.10.0.6/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.6/32
Loopback ip will be used as bgp router-id in frr
Leaf1(config-loif-0)# router bgp 65007
Leaf1(config-router)# neighbor 10.0.10.2 remote-as 65003
Leaf1(config-router)# neighbor 10.2.1.2 remote-as 65007
Leaf1(config-router)# route-map FROM_BGP_PEER_V4 permit 65535
Leaf1(config-route-map)# router bgp 65007
Leaf1(config-router)# address-family ipv4 unicast
Leaf1(config-router-af)# redistribute connected
Leaf1(config-router-af)# neighbor 10.2.1.2 route-map FROM_BGP_PEER_V4 in
Leaf1(config-router-af)# neighbor 10.2.1.2 route-map FROM_BGP_PEER_V4 out
Leaf1(config-router-af)# neighbor 10.0.10.2 route-map FROM_BGP_PEER_V4 in
Leaf1(config-router-af)# neighbor 10.0.10.2 route-map FROM_BGP_PEER_V4 out

5.4 Leaf2

5.4.1 设备恢复出厂设置

恢复Leaf2设备到出厂设置。

Leaf2# delete startup-config
Leaf2# reload

5.4.2 配置Leaf2端口速率

配置Leaf2交换机的Ethernet0口速率为10G。

Leaf2# configure terminal 
Leaf2(config)# interface ethernet 0/0 
Leaf2(config-if-0/0)# speed 10000
Leaf2(config-if-0/0)# show this
!
interface ethernet 0/0
speed 10000

5.4.3 配置Leaf2接口IP

在Leaf2交换机上配置与Leaf、Spine交换机的互联接口IP以及PortChannel、VLAN信息。

Leaf2# configure terminal 
Leaf2(config)# interface ethernet 0/48
Leaf2(config-if-0/48)# ip address 10.0.11.1/24
Leaf2(config-if-0/48)# interface link-aggregation 1
Leaf2(config-lagif-1)# interface ethernet 0/0     
Leaf2(config-if-0/0)# link-aggregation-group 1
Leaf2(config-if-0/0)# vlan 10
Leaf2(config-vlan-10)# vlan 30
Leaf2(config-vlan-30)# interface ethernet 0/56
Leaf2(config-if-0/56)# ip address 10.2.1.2/24
Leaf2(config-if-0/56)# mac-address 18:17:25:37:77:01
Leaf2(config-if-0/56)# interface ethernet 0/60
Leaf2(config-if-0/60)# switchport trunk vlan 10
Leaf2(config-if-0/60)# switchport trunk vlan 30
Leaf2(config-if-0/60)# interface vlan 10
Leaf2(config-vlanif-10)# ip address 100.0.10.1/24
Leaf2(config-vlanif-10)# interface link-aggregation 1
Leaf2(config-lagif-1)# switchport access vlan 10

5.4.4 配置Leaf2的MC-LAG

在Leaf2交换机上配置与Leaf1交换机互联接口的MC-LAG。

Leaf2# configure terminal 
Leaf2(config)# vlan 30
Leaf2(config-vlan-30)# interface vlan 30
Leaf2(config-vlanif-30)# ip address 11.0.0.7/24
Leaf2(config-vlanif-30)# mclag domain 1
Leaf2(mclag-domain)# local-address 11.0.0.7   
Leaf2(mclag-domain)# peer-address 11.0.0.6
Leaf2(mclag-domain)# peer-link ethernet 0/60
Leaf2(mclag-domain)# member lag 1
Leaf2(mclag-domain)# commit
Leaf2(mclag-domain)# interface vlan 10
Leaf2(config-vlanif-10)# mac-address 18:17:25:37:64:40

5.4.5 配置Leaf2的BGP

在Leaf2交换机上配置与Spine1交换机的BGP邻居。

Leaf2# configure terminal 
Leaf2(config)# router bgp 65007
Leaf2(config-router)# bgp router-id 10.10.0.7
Leaf2(config-router)# interface loopback 0
Leaf2(config-loif-0)# ip address 10.10.0.7/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.7/32
Loopback ip will be used as bgp router-id in frr
Leaf2(config-loif-0)# router bgp 65007
Leaf2(config-router)# neighbor 10.0.11.2 remote-as 65003
Leaf2(config-router)# neighbor 10.2.1.1 remote-as 65007
Leaf2(config-router)# route-map FROM_BGP_PEER_V4 permit 65535
Leaf2(config-route-map)# router bgp 65007
Leaf2(config-router)# address-family ipv4 unicast
Leaf2(config-router-af)# redistribute connected
Leaf2(config-router-af)# neighbor 10.2.1.1 route-map FROM_BGP_PEER_V4 in
Leaf2(config-router-af)# neighbor 10.2.1.1 route-map FROM_BGP_PEER_V4 out
Leaf2(config-router-af)# neighbor 10.0.11.2 route-map FROM_BGP_PEER_V4 in
Leaf2(config-router-af)# neighbor 10.0.11.2 route-map FROM_BGP_PEER_V4 out

5.5 Leaf3

5.5.1 设备恢复出厂设置

恢复Leaf3设备到出厂设置。

Leaf3# delete startup-config
Leaf3# reload

5.5.2 配置Leaf3端口速率

配置Leaf3交换机的Ethernet0口速率为10G。

Leaf3# configure terminal 
Leaf3(config)# interface ethernet 0/0
Leaf3(config-if-0/0)# speed 10000
Leaf3(config-if-0/0)# show this
!
interface ethernet 0/0
speed 10000

5.5.3 配置Leaf3接口IP

在Leaf3交换机上配置与Leaf、Spine交换机的互联接口IP以及PortChannel、VLAN信息。

Leaf3# configure terminal 
Leaf3(config-if-0/0)# interface ethernet 0/48
Leaf3(config-if-0/48)# ip address 10.0.12.1/24
Leaf3(config-if-0/48)# interface link-aggregation 1
Leaf3(config-lagif-1)# interface ethernet 0/0 
Leaf3(config-if-0/0)# link-aggregation-group 1
Leaf3(config-if-0/0)# vlan 20
Leaf3(config-vlan-20)# interface vlan 20
Leaf3(config-vlanif-20)# ip address 100.0.20.1/24
Leaf3(config-vlanif-20)# interface link-aggregation 1
Leaf3(config-lagif-1)# switchport access vlan 20

5.5.4 配置Leaf3的BGP

在Leaf3交换机上配置与Spine1交换机的BGP邻居。

Leaf3(config)# router bgp 65008
Leaf3(config-router)# bgp router-id 10.10.0.8
Leaf3(config-router)# interface loopback 0
Leaf3(config-loif-0)# ip address 10.10.0.8/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.8/32
Loopback ip will be used as bgp router-id in frr
Leaf3(config-loif-0)# route-map FROM_BGP_PEER_V4 permit 65535
Leaf3(config-route-map)# router bgp 65008
Leaf3(config-router)# neighbor 10.0.12.2 remote-as 65003
Leaf3(config-router)# address-family ipv4 unicast
Leaf3(config-router-af)# redistribute connected
Leaf3(config-router-af)# neighbor 10.0.12.2 route-map FROM_BGP_PEER_V4 in
Leaf3(config-router-af)# neighbor 10.0.12.2 route-map FROM_BGP_PEER_V4 out

6 故障转移和恢复测试

6.1 服务器通信测试

在Server3服务器上创建服务端,在Server1服务器使用iperf3软件生成TCP/UDP流量。

[root@server3 ~]# iperf3 -s
[root@server1 ~]# iperf3 -c 100.0.20.3  -l 20k -b 10G   -t 1000
在Server1服务器使用iperf3软件生成TCP/UDP流量

6.2 查看流量路径

Spine1:

查看流量路径

流量从Ethernet0口进,Ethernet8口出。

流量路径Server1-Leaf1-Spine1-Leaf3-Server3

6.3 查看设备路由信息

Spine1:

查看Spine1设备路由信息

Leaf1:

查看Leaf1设备路由信息

Leaf2:

查看Leaf2设备路由信息

6.4 故障测试

流量所在的上行链路断链,检查Leaf的路由信息,查看Server1和Server3打流情况。

Leaf1:
Leaf1(config)# interface ethernet 0/48
Leaf1(config-if-0/72)# shutdown
Server1 Server3打流没有出现断流,有轻微流量抖动:

查看Server1和Server3打流情况

检查Leaf1路由信息:

由于上行链路断链,Leaf1通过BGP邻居学习到100.0.20.0/24的路由通过三层冗余链路Ethernet56口10.2.1.2到Leaf2再到Spine1

检查Leaf1路由信息

检查Leaf2路由信息:

Leaf2路由信息没有变化

Leaf2路由信息

检查Spine1路由信息:

Spine1路由信息没有变化

Spine1路由信息

6.5 查看断链流量路径

Spine1:

 查看Spine1断链流量路径

流量从Ethernet4口进,Ethernet8口出。

Leaf2:

 查看Leaf2断链流量路径

流量从Leaf2三层冗余链路Ethernet56口进,Ethernet48口出到Spine1。

Leaf1:

 查看Leaf1断链流量路径

由于Leaf1上行链路断链,流量从Leaf1三层冗余链路Ethernet56口出,到Leaf2。

流量路径: Server1-Leaf1(三层冗余链路口)-Leaf2(三层冗余链路口)Spine1-Leaf3-Server3

6.6 故障恢复测试

恢复流量所在的上行链路故障,查看Server1和Server3打流情况。

Leaf1:
Leaf1(config)# interface ethernet 0/48
Leaf1(config-if-0/72)# startup

Server1 Server3打流没有出现断流,有轻微流量抖动:

Server1和Server3打流情况

检查Leaf1路由信息:

Leaf1上行链路断链恢复,路由恢复

Leaf1路由信息

检查Leaf2路由信息:

Leaf2路由信息没有变化

Leaf2路由信息

检查Spine1路由信息:

Spine1路由信息没有变化

Spine1路由信息

6.7 查看断链恢复流量路径

Spine1:

查看Spine1断链恢复流量路径

流量从Ethernet0口进,Ethernet8口出。

Leaf2:

查看Leaf2断链恢复流量路径

Leaf2没有流量

Leaf1:

查看Leaf1断链恢复流量路径

Leaf1流量从Ethernet0口进,Ethernet48口出到Spine1。

流量路径恢复: Server1-Leaf1-Spine1-Leaf3-Server3

7 结论

通过上述解决方案验证可知,CX-N系列交换机具备MC-LAG的三层高可用转发功能,同时具备端口、链路及设备组网通信的故障转移和恢复能力。

CX-N云网典型配置方案验证

1 方案概述

本文主要讲解CX-N 系列交换机基于MC-LAG实现的三层组网下的相关解决方案,验证网络通信、故障转移和恢复等能力。整个验证过程中交换机所有命令通过思科命令行配置完成。

2 物理网络拓扑

本次相关方案验证的整体物理拓扑如图1所示:

CX-N基于MC-LAG整体物理网络拓扑
图1:CX-N基于MC-LAG整体物理网络拓扑

3 硬件与软件环境

3.1 设备管理口

验证过程中所涉及到的设备、主机名及管理网口IP地址等信息,如表1所示:

设备主机名管理口IP地址备注
CX532-NSpine110.230.1.32 
CX532-NSpine210.230.1.33 
CX308-NLeaf110.230.1.18 
CX308-NLeaf210.230.1.19 
CX308-NLeaf310.230.1.20 
CX308-NLeaf410.230.1.21 
ServerServer110.230.1.11 
ServerServer210.230.1.13 
表1:设备管理口列表

3.2 硬件环境

验证环境中涉及到的硬件环境,如表2所示:

名称型号硬件指标数量备注
SpineCX532P-N【参见产品彩页】2 
LeafCX308P-48Y-N【参见产品彩页】4 
光模块10GSFP+8为了尽量减少物料种类,线缆和模块速率进行了统一,交换机互联使用100G模块和线缆,服务器需用10G模块和线缆
100GQSFP2824
网线//8 
光纤多模10G /25G适用4 
多模100G适用12 
服务器/内存推荐8G以上2 
表2:硬件环境

3.3 软件环境

验证环境中涉及到的软件环境,如表3所示:

名称版本备注
iperf33.1.7 
CX532-NSONiC.201911.R0314P04 
CX308-NSONiC.201911.R0314P04 
服务器系统CentOS Linux 7.8.2003 
服务器内核3.10.0-1127.18.2.el7 
表3:软件环境

4 基础环境部署

在两台Server服务器上,安装部署本次验证方案的所需要的基础软件。

补充说明:以”[root@server ~]#”为开头的命令表示两台服务器都要执行。

4.1 LLDP

在两台Server服务器上安装LLDP服务,如果是X710网卡要求网卡驱动版本大于2.3.6,然后配置网卡开启LLDP。

[root@server ~]# yum -y install epel-release
[root@server ~]# yum -y install lldpd
[root@server ~]# systemctl start lldpd
[root@server ~]# systemctl enable lldpd
[root@server ~]# lspci |grep -i ether
配置网卡开启LLDP
[root@server ~]# ethtool -i ens1f2
[root@server ~]# ethtool -i ens1f3
ethtool -i ens1f2
 ethtool -i ens1f3
[root@sever ~]# ethtool --set-priv-flags ens1f2 disable-fw-lldp on
[root@sever ~]# ethtool --set-priv-flags ens1f3 disable-fw-lldp on

4.2 安装iPerf3 

在2台Server服务器上安装iPerf3软件用来打流。

在3台服务器上上执行:
[root@server ~]# yum -y install iperf3
[root@server ~]# iperf3 -v
iperf 3.1.7
Linux compute-2 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 2022 x86_64
Optional features available: CPU affinity setting, IPv6 flow label, TCP congestion algorithm setting, sendfile / zerocopy, socket pacing

4.3 检查链路连接

所有交换机设备要提前检查和Server服务器之间的链路连接情况,确保交换机设备和Server服务器之间的链路连接没有问题,以下命令在所有交换机设备上执行。

admin@sonic:~$ sudo config cli-mode cli
admin@sonic:~$ sudo sonic-cli
sonic#
Spine1# show lldp table
检查Spine1链路情况
Spine2# show lldp table
检查Spine2链路情况
Leaf1# show lldp table
检查Leaf1链路情况
Leaf2# show lldp table
检查Leaf2链路情况
Leaf3# show lldp table
检查Leaf3链路情况
Leaf4# show lldp table
检查Leaf4链路情况

5 组网环境配置   

5.1 逻辑拓扑

组网逻辑拓扑与接口配置
图2:组网逻辑拓扑与接口配置

5.2 Spine1

5.2.1 设备恢复出厂设置

配置思科命令行,恢复Spine1设备到出厂设置。

Spine1@sonic:~$ sudo config cli-mode cli
Spine1@sonic:~$ sudo sonic-cli
sonic# delete startup-config
sonic# reload

5.2.2 配置Spine1 接口IP

在Spine1交换机上配置与4台Leaf交换机的互联接口IP。

Spine1# configure terminal
Spine1(config)# interface ethernet 0/0
Spine1(config-if-0/0)# ip address 10.0.10.2/24
Spine1(config)# interface ethernet 0/4
Spine1(config-if-0/4)# ip address 10.0.11.2/24
Spine1(config)# interface ethernet 0/8
Spine1(config-if-0/8)# ip address 10.0.12.2/24
Spine1(config)# interface ethernet 0/12
Spine1(config-if-0/12)# ip address 10.0.13.2/24

5.2.3 配置Spine1 的BGP

在Spine1交换机上配置4台Leaf交换机的BGP邻居。

Spine1# configure terminal
Spine1(config)# router bgp 65003     
Spine1(config-router)# bgp router-id 10.10.0.3
Spine1(config)# interface loopback 0
Spine1(config-loif-0)# ip address 10.10.0.3/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.3/32
Loopback ip will be used as bgp router-id in frr
Spine1(config)# router bgp 65003
Spine1(config-router)# no bgp ebgp-requires-policy 
Spine1(config-router)# neighbor 10.0.10.1 remote-as 65007
Spine1(config-router)# neighbor 10.0.11.1 remote-as 65007
Spine1(config-router)# neighbor 10.0.12.1 remote-as 65008
Spine1(config-router)# neighbor 10.0.13.1 remote-as 65008
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)# neighbor 10.0.12.1 activate
Spine1(config-router-af)# neighbor 10.0.13.1 activate
Spine1(config-router-af)# advertise-all-vni
Spine1(config)# write
Spine1(config)# reload

5.3 Spine2

5.3.1 设备恢复出厂设置

配置思科命令行,恢复Spine2设备到出厂设置。

Spine2@sonic:~$ sudo config cli-mode cli
Spine2@sonic:~$ sudo sonic-cli
sonic# delete startup-config
sonic# reload

5.3.2 配置Spine2接口IP

在Spine2交换机上配置与4台Leaf交换机的互联接口IP。

Spine2# configure terminal
Spine2(config)# interface ethernet 0/0
Spine2(config-if-0/0)# ip address 10.1.10.2/24
Spine2(config)# interface ethernet 0/4
Spine2(config-if-0/4)# ip address 10.1.11.2/24
Spine2(config)# interface ethernet 0/8
Spine2(config-if-0/8)# ip address 10.1.12.2/24
Spine2(config)# interface ethernet 0/12
Spine2(config-if-0/12)# ip address 10.1.13.2/24

5.3.3 配置Spine2的BGP

在Spine2交换机上配置4台Leaf交换机的BGP邻居。

Spine2# configure terminal
Spine2(config)# router bgp 65004
Spine2(config-router)# bgp router-id 10.10.0.4
Spine2(config)# interface loopback 0
Spine2(config-loif-0)# ip address 10.10.0.4/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.3/32
Loopback ip will be used as bgp router-id in frr
Spine2(config)# router bgp 65004
Spine2(config-router)# no bgp ebgp-requires-policy 
Spine2(config-router)# neighbor 10.1.10.1 remote-as 65007
Spine2(config-router)# neighbor 10.1.11.1 remote-as 65007
Spine2(config-router)# neighbor 10.1.12.1 remote-as 65008
Spine2(config-router)# neighbor 10.1.13.1 remote-as 65008
Spine2(config-router)# address-family l2vpn evpn
Spine2(config-router-af)# neighbor 10.1.10.1 activate
Spine2(config-router-af)# neighbor 10.1.11.1 activate
Spine2(config-router-af)# neighbor 10.1.12.1 activate
Spine2(config-router-af)# neighbor 10.1.13.1 activate
Spine2(config-router-af)# advertise-all-vni
Spine2(config)# write
Spine2(config)# reload

5.4 Leaf1

5.4.1 设备恢复出厂设置

恢复Leaf1设备到出厂设置。

Leaf1# delete startup-config
Leaf1# reload

5.4.2 配置Leaf1端口速率

配置Leaf1交换机的Ethernet0口速率为10G。

Leaf1# configure terminal 
Leaf1(config)# interface ethernet 0/0  
Leaf1(config-if-0/0)# speed 10000
Leaf1(config-if-0/0)# show this
!
interface ethernet 0/0
speed 10000

5.4.3 配置Leaf1接口IP

在Leaf1交换机上配置与Leaf、Spine交换机的互联接口IP以及PortChannel、VLAN信息。

Leaf1# configure terminal 
Leaf1(config)# interface ethernet 0/48
Leaf1(config-if-0/48)# ip address 10.0.10.1/24
Leaf1(config)# interface ethernet 0/52
Leaf1(config-if-0/52)# ip address 10.1.10.1/24
Leaf1(config)# interface link-aggregation 1
Leaf1(config)# interface link-aggregation 3
Leaf1(config)# interface ethernet 0/0
Leaf1(config-if-0/0)# link-aggregation-group 1
Leaf1(config-if-0/0)# interface ethernet 0/56
Leaf1(config-if-0/56)# link-aggregation-group 3
Leaf1(config-if-0/56)# interface ethernet 0/60
Leaf1(config-if-0/60)# link-aggregation-group 3
Leaf1(config)# vlan 10
Leaf1(config)# interface vlan 10
Leaf1(config-vlanif-10)# ip address 100.0.10.1/24
Leaf1(config)# interface link-aggregation 1
Leaf1(config-lagif-1)# switchport access vlan 10
Leaf1(config)# interface link-aggregation 3
Leaf1(config-lagif-3)# switchport trunk vlan 10

5.4.4 配置Leaf1的MC-LAG

在Leaf1交换机上配置与Leaf2交换机互联接口的MC-LAG。

Leaf1# configure terminal 
Leaf1(config)# vlan 30
Leaf1(config)# interface link-aggregation 3
Leaf1(config-lagif-3)# switchport trunk vlan 30
Leaf1(config)# interface vlan 30
Leaf1(config-vlanif-30)# ip address 11.0.0.6/24
Leaf1(config)# mclag domain 1
Leaf1(mclag-domain)# peer-link link-aggregation 3 
Leaf1(mclag-domain)# local-address 11.0.0.6   
Leaf1(mclag-domain)# peer-address 11.0.0.7
Leaf1(mclag-domain)# member lag 1
Leaf1(mclag-domain)# commit
Leaf1(config)# interface vlan 10
Leaf1(config-vlanif-10)# mac-address 18:17:25:37:64:40

5.4.5 配置Leaf1的BGP

在Leaf1交换机上配置2台Spine交换机的BGP邻居。

Leaf1# configure terminal 
Leaf1(config)# router bgp 65007
Leaf1(config-router)# bgp router-id 10.10.0.7
Leaf1(config)# interface loopback 0
Leaf1(config-loif-0)# ip address 10.10.0.7/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.7/32
Loopback ip will be used as bgp router-id in frr
Leaf1(config)# router bgp 65007
Leaf1(config-router)# no bgp ebgp-requires-policy
Leaf1(config-router)# neighbor 10.0.10.2 remote-as 65003
Leaf1(config-router)# neighbor 10.1.10.2 remote-as 65004
Leaf1(config-router)# address-family ipv4 unicast
Leaf1(config-router)# network 10.10.0.7/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

5.4.6 配置Leaf1 的EVPN

在Leaf1交换机上配置EVPN、创建VNET,建立二三层VXLAN映射。

Leaf1# configure terminal
Leaf1(config)# interface vxlan 0
Leaf1(config-vxlanif-0)# source 10.10.0.7
Leaf1(config)# evpn-overlay enable
Leaf1(config)# vrf 123
Leaf1(config-vrf)# mac 60:eb:5a:00:86:20
Leaf1(config-vrf)# interface vlan 10
Leaf1(config-vlanif-10)# vrf 123
Leaf1(config)# vlan 10
Leaf1(config-vlan-10)# vni 10
Leaf1(config)# vrf 123
Leaf1(config-vrf)# vni 1000
Leaf1(config)# write
Leaf1(config)# reload

5.5 Leaf2

5.5.1 设备恢复出厂设置

恢复Leaf2设备到出厂设置。

Leaf2# delete startup-config
Leaf2# reload

5.5.2 配置Leaf2 端口速率

配置Leaf2交换机的Ethernet0口速率为10G。

Leaf2# configure terminal 
Leaf2(config)# interface ethernet 0/0 
Leaf2(config-if-0/0)# speed 10000
Leaf2(config-if-0/0)# show this
!
interface ethernet 0/0
speed 10000

5.5.3 配置Leaf2接口IP

在Leaf2交换机上配置与Leaf、Spine交换机的互联接口IP以及PortChannel、VLAN信息。

Leaf2# configure terminal 
Leaf2(config)# interface ethernet 0/48
Leaf2(config-if-0/48)# ip address 10.0.11.1/24
Leaf2(config)# interface ethernet 0/52
Leaf2(config-if-0/52)# ip address 10.1.11.1/24
Leaf2(config) interface link-aggregation 1
Leaf2(config) interface link-aggregation 3
Leaf2(config)# interface ethernet 0/0     
Leaf2(config-if-0/0)# link-aggregation-group 1
Leaf2(config-if-0/0)# interface ethernet 0/56
Leaf2(config-if-0/56)# link-aggregation-group 3
Leaf2(config-if-0/56)# interface ethernet 0/60
Leaf2(config-if-0/60)# link-aggregation-group 3
Leaf2(config)# vlan 10
Leaf2(config)# interface vlan 10
Leaf2(config-vlanif-10)# ip address 100.0.10.1/24
Leaf2(config)# interface link-aggregation 1
Leaf2(config-lagif-1)# switchport access vlan 10
Leaf2(config)# interface link-aggregation 3
Leaf2(config-lagif-3)# switchport trunk vlan 10

5.5.4 配置Leaf2的MC-LAG

在Leaf2交换机上配置与Leaf1交换机互联接口的MC-LAG。

Leaf2# configure terminal 
Leaf2(config)# vlan 30
Leaf2(config)# interface link-aggregation 3
Leaf2(config-lagif-3)# switchport trunk vlan 30
Leaf2(config)# interface vlan 30
Leaf2(config-vlanif-30)# ip address 11.0.0.7/24
Leaf2(config)# mclag domain 1
Leaf2(mclag-domain)# peer-link link-aggregation 3 
Leaf2(mclag-domain)# local-address 11.0.0.7   
Leaf2(mclag-domain)# peer-address 11.0.0.6
Leaf2(mclag-domain)# member lag 1
Leaf2(mclag-domain)# commit
Leaf2(config)# interface vlan 10
Leaf2(config-vlanif-10)# mac-address 18:17:25:37:64:40

5.5.5 配置Leaf2的BGP

在Leaf2交换机上配置2台Spine交换机的BGP邻居。

Leaf2# configure terminal 
Leaf2(config)# router bgp 65007
Leaf2(config-router)# bgp router-id 10.10.0.7
Leaf2(config)# interface loopback 0
Leaf2(config-loif-0)# ip address 10.10.0.7/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.7/32
Loopback ip will be used as bgp router-id in frr
Leaf2(config)# router bgp 65007
Leaf2(config-router)# no bgp ebgp-requires-policy
Leaf2(config-router)# neighbor 10.0.11.2 remote-as 65003
Leaf2(config-router)# neighbor 10.1.11.2 remote-as 65004
Leaf2(config-router)# address-family ipv4 unicast
Leaf2(config-router)# network 10.10.0.7/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

5.5.6 配置Leaf2 的EVPN

在Leaf2交换机上配置EVPN、创建VNET,建立二三层VXLAN映射。

Leaf2# configure terminal
Leaf2(config)# interface vxlan 0
Leaf2(config-vxlanif-0)# source 10.10.0.7
Leaf2(config)# evpn-overlay enable
Leaf2(config)# vrf 123
Leaf2(config-vrf)# mac 60:eb:5a:00:86:20
Leaf2(config-vrf)# interface vlan 10
Leaf2(config-vlanif-10)# vrf 123
Leaf2(config)# vlan 10
Leaf2(config-vlan-10)# vni 10
Leaf2(config)# vrf 123
Leaf2(config-vrf)# vni 1000
Leaf2(config)# write
Leaf2(config)# reload

5.6 Leaf3

5.6.1 设备恢复出厂设置

恢复Leaf3设备到出厂设置。

Leaf3# delete startup-config
Leaf3# reload

5.6.2 配置Leaf3 端口速率

配置Leaf3交换机的Ethernet0口速率为10G。

Leaf3# configure terminal 
Leaf3(config)# interface ethernet 0/0
Leaf3(config-if-0/0)# speed 10000
Leaf3(config-if-0/0)# show this
!
interface ethernet 0/0
speed 10000

5.6.3 配置Leaf3接口IP

在Leaf3交换机上配置与Leaf、Spine交换机的互联接口IP以及PortChannel、VLAN信息。

Leaf3# configure terminal 
Leaf3(config)# interface ethernet 0/48
Leaf3(config-if-0/48)# ip address 10.0.12.1/24
Leaf3(config)# interface ethernet 0/52
Leaf3(config-if-0/52)# ip address 10.1.12.1/24
Leaf3(config) interface link-aggregation 1
Leaf3(config) interface link-aggregation 3
Leaf3(config)# interface ethernet 0/0 
Leaf3(config-if-0/0)# link-aggregation-group 1
Leaf3(config-if-0/0)# interface ethernet 0/56
Leaf3(config-if-0/56)# link-aggregation-group 3
Leaf3(config-if-0/56)# interface ethernet 0/60
Leaf3(config-if-0/60)# link-aggregation-group 3
Leaf3(config)# vlan 20
Leaf3(config)# interface vlan 20
Leaf3(config-vlanif-20)# ip address 100.0.20.1/24
Leaf3(config)# interface link-aggregation 1
Leaf3(config-lagif-1)# switchport access vlan 20
Leaf3(config)# interface link-aggregation 3
Leaf3(config-lagif-3)# switchport trunk vlan 20

5.6.4 配置Leaf3的MC-LAG

在Leaf3交换机上配置与Leaf4交换机互联接口的MC-LAG。

Leaf3(config)# vlan 30
Leaf3(config)# interface link-aggregation 3
Leaf3(config-lagif-3)# switchport trunk vlan 30
Leaf3(config)# interface vlan 30
Leaf3(config-vlanif-30)# ip address 11.0.0.8/24
Leaf3(config)# mclag domain 1
Leaf3(mclag-domain)# peer-link link-aggregation 3 
Leaf3(mclag-domain)# local-address 11.0.0.8 
Leaf3(mclag-domain)# peer-address 11.0.0.9
Leaf3(mclag-domain)# member lag 1
Leaf3(mclag-domain)# commit
Leaf3(config)# interface vlan 20
Leaf3(config-vlanif-20)# mac-address 18:17:25:37:64:32

5.6.5 配置Leaf3的BGP

在Leaf3交换机上配置2台Spine交换机的BGP邻居。

Leaf3(config)# router bgp 65008
Leaf3(config-router)# bgp router-id 10.10.0.8
Leaf3(config)# interface loopback 0
Leaf3(config-loif-0)# ip address 10.10.0.8/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.8/32
Loopback ip will be used as bgp router-id in frr
Leaf3(config)# router bgp 65008
Leaf3(config-router)# no bgp ebgp-requires-policy
Leaf3(config-router)# neighbor 10.0.12.2 remote-as 65003
Leaf3(config-router)# neighbor 10.1.12.2 remote-as 65004
Leaf3(config-router)# address-family ipv4 unicast
Leaf3(config-router)# network 10.10.0.8/32
Leaf3(config-router)# address-family l2vpn evpn
Leaf3(config-router-af)# neighbor 10.0.12.2 activate
Leaf3(config-router-af)# neighbor 10.1.12.2 activate
Leaf3(config-router-af)# advertise-all-vni

5.6.6 配置Leaf3 的EVPN

在Leaf3交换机上配置EVPN、创建VNET,建立二三层VXLAN映射。

Leaf3# configure terminal
Leaf3(config)# interface vxlan 0
Leaf3(config-vxlanif-0)# source 10.10.0.8
Leaf3(config)# evpn-overlay enable
Leaf3(config)# vrf 456
Leaf3(config-vrf)# mac 60:eb:5a:00:86:22
Leaf3(config-vrf)# interface vlan 20
Leaf3(config-vlanif-10)# vrf 456
Leaf3(config)# vlan 20
Leaf3(config-vlan-10)# vni 20
Leaf3(config)# vrf 456
Leaf3(config-vrf)# vni 1000
Leaf3(config)# write
Leaf3(config)# reload

5.7 Leaf4

5.7.1 设备恢复出厂设置

恢复Leaf4设备到出厂设置。

Leaf4# delete startup-config
Leaf4# reload

5.7.2 配置Leaf4 端口速率

配置Leaf4交换机的Ethernet0口速率为10G。

Leaf4# configure terminal 
Leaf4(config)# interface ethernet 0/0
Leaf4(config-if-0/0)# speed 10000
Leaf4(config-if-0/0)# show this
!
interface ethernet 0/0
speed 10000

5.7.3 配置Leaf4接口IP

在Leaf4交换机上配置与Leaf、Spine交换机的互联接口IP以及PortChannel、VLAN信息。

Leaf4# configure terminal 
Leaf4(config)# interface ethernet 0/48
Leaf4(config-if-0/48)# ip address 10.0.13.1/24
Leaf4(config)# interface ethernet 0/52
Leaf4(config-if-0/52)# ip address 10.1.13.1/24
Leaf4(config) interface link-aggregation 1
Leaf4(config) interface link-aggregation 3
Leaf4(config)# interface ethernet 0/0    
Leaf4(config-if-0/0)# link-aggregation-group 1
Leaf4(config-if-0/0)# interface ethernet 0/56
Leaf4(config-if-0/56)# link-aggregation-group 3
Leaf4(config-if-0/56)# interface ethernet 0/60
Leaf4(config-if-0/60)# link-aggregation-group 3
Leaf4(config)# vlan 20
Leaf4(config)# interface vlan 20
Leaf4(config-vlanif-20)# ip address 100.0.20.1/24
Leaf4(config)# interface link-aggregation 1
Leaf4(config-lagif-1)# switchport access vlan 20
Leaf4(config)# interface link-aggregation 3
Leaf4(config-lagif-3)# switchport trunk vlan 20

5.7.4 配置Leaf4的MC-LAG

在Leaf4交换机上配置与Leaf3交换机互联接口的MC-LAG。

Leaf4(config)# vlan 30
Leaf4(config)# interface link-aggregation 3
Leaf4(config-lagif-3)# switchport trunk vlan 30
Leaf4(config)# interface vlan 30
Leaf4(config-vlanif-30)# ip address 11.0.0.9/24
Leaf4(config)# mclag domain 1
Leaf4(mclag-domain)# peer-link link-aggregation 3 
Leaf4(mclag-domain)# local-address 11.0.0.9
Leaf4(mclag-domain)# peer-address 11.0.0.8
Leaf4(mclag-domain)# member lag 1
Leaf4(mclag-domain)# commit
Leaf4(config)# interface vlan 20
Leaf4(config-vlanif-20)# mac-address 18:17:25:37:64:32

5.7.5 配置Leaf4的BGP

在Leaf4交换机上配置2台Spine交换机的BGP邻居。

Leaf4(config)# router bgp 65008
Leaf4(config-router)# bgp router-id 10.10.0.8
Leaf4(config)# interface loopback 0
Leaf4(config-loif-0)# ip address 10.10.0.8/32
Change Loopback0 ip from 10.1.0.1/32 to 10.10.0.8/32
Loopback ip will be used as bgp router-id in frr
Leaf4(config)# router bgp 65008
Leaf4(config-router)# no bgp ebgp-requires-policy
Leaf4(config-router)# neighbor 10.0.13.2 remote-as 65003
Leaf4(config-router)# neighbor 10.1.13.2 remote-as 65004
Leaf4(config-router)# address-family ipv4 unicast
Leaf4(config-router)# network 10.10.0.8/32
Leaf4(config-router)# address-family l2vpn evpn
Leaf4(config-router-af)# neighbor 10.0.13.2 activate
Leaf4(config-router-af)# neighbor 10.1.13.2 activate
Leaf4(config-router-af)# advertise-all-vni

5.7.6 配置Leaf4 的EVPN

在Leaf4交换机上配置EVPN、创建VNET,建立二三层VXLAN映射。

Leaf4# configure terminal
Leaf4(config)# interface vxlan 0
Leaf4(config-vxlanif-0)# source 10.10.0.8
Leaf4(config)# evpn-overlay enable
Leaf4(config)# vrf 456
Leaf4(config-vrf)# mac 60:eb:5a:00:86:22
Leaf4(config-vrf)# interface vlan 20
Leaf4(config-vlanif-10)# vrf 456
Leaf4(config)# vlan 20
Leaf4(config-vlan-10)# vni 20
Leaf4(config)# vrf 456
Leaf4(config-vrf)# vni 1000
Leaf4(config)# write
Leaf4(config)# reload

更多内容请参考:A-Lab

对星融元产品感兴趣?

立即联系!

返回顶部

© 星融元数据技术(苏州)有限公司 苏ICP备17070048号-2