• dpdk结合sriov测试vpp ipsec性能


    目的

    测试vpp ipsec转发性能,想当作openstack VPNaas的一种driver,提高ipsec网关的转发能力。

    环境

    测试资源很有限,没有测试仪,物理机之外的交换机不受控制。

    只有两台物理机,各有一张测试网卡,网卡有两个10G口,可能确定的是两台物理机一个10G口之间联到同一个TOR交换机可能互通,另一对10G口之间测试不通。

    想法就是vpp两个口,一个口当作网关,另一个口用来做tunnel。

    vpp版本是master commit 6e39ff03a6fa28a2655d767454394413252a269d,早期版本ipsec有bug.

    vpp用到了dpdk,需要先创建hugepage和网卡绑定igb_uio,不再特殊强调。

    第一种方法

    创建一对veth pair,一个放在namespace中,一个放在vpp上当host interface。

    机器1上操作:

    1. #服务器1配置
    2. ip netns add ns0
    3. ip link add vpp0 type veth peer name host_vpp0
    4. ip link set vpp0 up
    5. ip link set host_vpp0 netns ns0
    6. ip netns exec ns0 ip link set lo up
    7. ip netns exec ns0 ip link set host_vpp0 up
    8. ip netns exec ns0 ip addr add 192.168.1.1/24 dev host_vpp0
    9. ip netns exec ns0 ip route add default via 192.168.1.2 dev host_vpp0
    10. #启动vpp
    11. /home/huiwei/vpp/build-root/build-vpp-native/vpp/bin/vpp -c /home/huiwei/vsap/configs/startup.conf
    12. #vpp1的配置
    13. set interface state TenGigabitEthernet3/0/1 up
    14. set interface ip address TenGigabitEthernet3/0/1 192.168.3.1/24
    15. set interface promiscuous on TenGigabitEthernet3/0/1
    16. create host-interface name vpp0 hw-addr fa:16:19:19:19:19
    17. set interface state host-vpp0 up
    18. set interface ip address host-vpp0 192.168.1.2/24
    19. create ipip tunnel src 192.168.3.1 dst 192.168.3.2
    20. ipsec sa add 10 spi 1000 esp crypto-key 4339314b55523947594d6d3547666b45 crypto-alg aes-cbc-128 integ-key 4339314b55523947594d6d3547666b45 integ-alg sha1-96
    21. ipsec tunnel protect ipip0 sa-in 10 sa-out 10 192.168.3.2
    22. ip route add 192.168.2.0/24 via 192.168.3.2 ipip0
    23. set interface unnumbered ipip0 use TenGigabitEthernet3/0/1
    24. set interface state ipip0 up

    复制

    机器2上操作:

    1. #服务器2配置
    2. ip netns add ns0
    3. ip link add vpp0 type veth peer name host_vpp0
    4. ip link set vpp0 up
    5. ip link set host_vpp0 netns ns0
    6. ip netns exec ns0 ip link set lo up
    7. ip netns exec ns0 ip link set host_vpp0 up
    8. ip netns exec ns0 ip addr add 192.168.2.1/24 dev host_vpp0
    9. ip netns exec ns0 ip route add default via 192.168.2.2 dev host_vpp0
    10. #启动vpp
    11. /home/huiwei/vpp/build-root/build-vpp-native/vpp/bin/vpp -c /home/huiwei/vsap/configs/startup.conf
    12. #vpp2的配置
    13. set interface state TenGigabitEthernet3/0/1 up
    14. set interface ip address TenGigabitEthernet3/0/1 192.168.3.2/24
    15. set interface promiscuous on TenGigabitEthernet3/0/1
    16. create host-interface name vpp0 hw-addr fa:16:29:29:29:29
    17. set interface state host-vpp0 up
    18. set interface ip address host-vpp0 192.168.2.2/24
    19. create ipip tunnel src 192.168.3.2 dst 192.168.3.1
    20. ipsec sa add 10 spi 1000 esp crypto-key 4339314b55523947594d6d3547666b45 crypto-alg aes-cbc-128 integ-key 4339314b55523947594d6d3547666b45 integ-alg sha1-96
    21. ipsec tunnel protect ipip0 sa-in 10 sa-out 10 192.168.3.1
    22. ip route add 192.168.1.0/24 via 192.168.3.1 ipip0
    23. set interface unnumbered ipip0 use TenGigabitEthernet3/0/1
    24. set interface state ipip0 up

    复制

    测试结果比较差,分析原因第一是vpp host interface收包时大量丢包,第二就是iperf3测试工具不好用。

    1. ip netns exec ns0 iperf3 -c 192.168.1.1 -u -l 64 -P 128 -t 5
    2. #no ipsec
    3. [SUM] 0.00-5.00 sec 64.5 MBytes 108 Mbits/sec 42.081 ms 554038/1056128 (52%)
    4. #aesni_mb
    5. [SUM] 0.00-5.00 sec 67.6 MBytes 113 Mbits/sec 26.476 ms 775537/1105258 (70%)
    6. #openssl
    7. [SUM] 0.00-5.00 sec 69.2 MBytes 116 Mbits/sec 11.179 ms 886194/1132434 (78%)

    复制

    第二种方法

    既然veth pair不好用,那就用物理网卡,但卡又不够用,外面交换机又不受控制,突然想到了sriov,多虚出来几个物理网卡。iperf3用dpdk-ptkgen或者test-pmd替代。dpdk用一个vf作为host,vpp用另一个vf作为网关,这两个vf之间互通用网卡内嵌的switch。

    PS:sriov有个问题就是网卡内嵌的switch只转发它自己的pf和vf的mac,不学习mac,所以openstack中sriov虚机和同host上virtio虚机或者dvr网关是通不了的。

    vpp另一个网卡本来想直接用整个物理网卡,但是结果用着用着就莫名其妙NO-CARRIER了,提示没有接网线,原因不明,reboot物理机就好了,试着用vf就没再碰到这个问题

    dpdk test-pmd只显示发包和收包个数,不能显示实时速率,采用low一点的手法,用手机秒表计时300s计算pps,不是非常精确。

    1. #纯IP转发vpp1
    2. set interface state VirtualFunctionEthernet3/10/1 up
    3. set interface state VirtualFunctionEthernet3/10/0 up
    4. set interface ip address VirtualFunctionEthernet3/10/1 192.168.3.1/24
    5. set interface ip address VirtualFunctionEthernet3/10/0 192.168.1.2/24
    6. ip route add 192.168.2.0/24 v
  • 相关阅读:
    linux中的cd 切换目录、more 文件内容分屏查看器
    操作系统分页、分段
    Centos 中如何汉化man命令
    2023 年您需要了解哪些类型的数据泄露?
    【Vue】vue使用server酱发送微信通知实战案例,axios发送server酱通知信息实战,js发送server酱教程
    vue-router实现history模式配置(生产环境路由失效跟刷新404问题)
    Apache shiro RegExPatternMatcher 权限绕过漏洞 (CVE-2022-32532)
    警告:新版Outlook会向微软发送密码、邮件和其他数据
    Vert.x 源码解析(4.x)(一)——Future源码解析
    SpringBoot介绍
  • 原文地址:https://blog.csdn.net/lingshengxiyou/article/details/128025844