VPP-ACL

原文:https://s3-docs.fd.io/vpp/23.06/usecases/acls.html#aclplugin

vpp 访问控制列表(ACL)

本节概述了vpp中ACLs的可用选项。因为有许多方法可以实现类似ACL的功能,所以值得对这些选项进行单独的概述,并对ACL的特性和性能进行讨论。本文档中的所有性能数据和示例都是来自于FD.io CSIT v19.04 performance report , FD.io VPP 19.04 发布版的所有信息和性能数据都是准确的。以下章节的性能和操作数据与FD.io CSIT性能报告中的章节直接相关。

Summary

Option

Relative Performan ce

Features & Notes

The FD.io VPP ACL Plugin

Lowest

Match on restricted L2-L4 fields, stateful & stateless

FD.io VPP COP

Highest (software only)

Match on Layer 3 IPs, stateless

FD.io VPP Flow

Highest (accelera ted)

Match on restricted L2-L4 fields, stateless, limited number of flows

FD.io VPP Classifiers

TBD

Match on any field in the first 80 bytes, Not measured

备注:上面的表格是vpp实现acl的的4种形式,

  • ACL-Plugins是使用vpp 插件形式实现的访问控制,性能最低,但可定制化高,很容易满足业务需求;
  • VPP COP使用的是在查询路由时,通过白名单实现的访问控制,性能较好,但只能到三层,且无状态;
  • VPP Flow需要使用网卡的硬件功能,比如使用intel 网卡的Flow Director功能,这个硬件绑定太高,实现难度大,也是无状态;
  • VPP Classifiers使用按位与算法匹配数据包前80字节,性能高,但没有进行实际测量和使用,也是无状态。

vppACL 选项

vpp ACL Plugin

这个插件最初是作为vpp的一部分开发的,并和OpenStack进行集成。插件需要在特定的接口上启用。

acl 支持有状态和无状态

  • MACs
  • IPs
  • UDP Ports
  • TCP Ports & Flags
  • ICMP Messages

方向(Directional)

  • Input:作用于IP流分级前(也就是接口收到报文开始处,分为L2,L3)
  • Output:作用于接口output节点前(每个接口都有一个output节点)

动作(Actions)

  • Permit (sl) :允许(无会话,匹配单向数据流,返程数据需要再配置规则)

  • Drop (sf)    :丢弃 (文档写的是sf,但看23.06的代码,没有发现创建会话,猜测是写错了)

  • Permit+Reflect (sf) :允许(有会话,配置单方向,另一方向自动配置,允许)

有状态(sf)

  • Actions: permit+reflect

  • 最重要的优化,因为是最常见的用例。

  • 因为使用了会话查询,性能更好。当创建好会话后,后面的数据报文只会查询一次。

  • 使用更多的内存,性能不确定性增加,因为使用了会话缓存,它更容易被内存层次结构和局部性影响。

无状态(sl)

  • Actions : permit, drop

  • 缺少优化,不常用示例

  • 比有状态慢,因为没有会话缓存,每个数据包都需要经过同样完整的处理流程。

  • 使用更少的内存,性能稳定(相较于有状态)

备注:这里提到的确定性(deterministic)指的的性能稳定性,因为有状态需要更多的内存,内存的结构和其他因素对acl性能有影响比无状态大,但总体来说,有状态比无状态性能好。

运行数据

重点查看acl 函数的Clocks,越小性能越好。

Input/Stateless

Test Case: 10ge2p1x520-ethip4udp-ip4base-iacl1sl-10kflows-ndrpdr

Input/Stateful

Test Case: 64b-1t1c-ethip4udp-ip4base-iacl1sf-10kflows-ndrpdr

Output/Stateless

Test Case: 64b-1t1c-ethip4udp-ip4base-oacl10sl-10kflows-ndrpdr

 

Output/Stateful

Test Case: 64b-1t1c-ethip4udp-ip4base-oacl10sf-10kflows-ndrpdr

 性能

Test Case

MPPS

Cycles per packet

ethip4-ip4base

18.26

136

ethip4ip4udp-ip4base-iacl1sl-10kflows

9.134

273

ethip4ip4udp-ip4base-iacl1sf-10kflows

11.06

226

Input ACLS (SKX)

Output ACLs (HSW)

 

Configuration

Stateful

sudo vppctl ip_add_del_route 20.20.20.0/24 via 1.1.1.2  sw_if_index 1 resolve-attempts 10 count 1
sudo vppctl acl_add_replace  ipv4 permit src 30.30.30.1/32 dst 40.40.40.1/32 sport 1000 dport 1000, ipv4 permit+reflect src 10.10.10.0/24, ipv4 permit+reflect src 20.20.20.0/24
sudo vppctl acl_interface_set_acl_list sw_if_index 2 input 0
sudo vppctl acl_interface_set_acl_list sw_if_index 1 input 0

Stateless

sudo vppctl ip_add_del_route 20.20.20.0/24 via 1.1.1.2  sw_if_index 1 resolve-attempts 10 count 1
sudo vppctl acl_add_replace  ipv4 permit src 30.30.30.1/32 dst 40.40.40.1/32 sport 1000 dport 1000, ipv4 permit src 10.10.10.0/24, ipv4 permit src 20.20.20.0/24
sudo vppctl acl_interface_set_acl_list sw_if_index 2 input 0
sudo vppctl acl_interface_set_acl_list sw_if_index 1 input 0

Links

VPP COP

VPP 的FIB中使用ipv4/ipv6 白名单,支持多重嵌套。

cop功能简介

cop feature通过使用fib,实现数据包的依次匹配过滤功能。它们主要的作用是通过添加fib表,对数据包进行源地址过滤。

设计注释:

  • cop 节点(input & white-list)在vpp FIB 2.0中被重新启用,从本质上讲,如果在FIB中查找成功,则表明数据包已被列入白名单,可以转发。
  • cop-input节点:判别数据帧是ipv4 或者是ipv6,然后转发到ipN-copwhitelist节点ip4-copwhitelist/ip6-copwhitelist。
  • ipN-copwhitelist: 使用ip4_fib_[mtrie,lookup]函数确认报文的IP是否与白名单fib中的路由匹配。
  • Match: 如果匹配,则发送到下一个白名单或IP层。
  • No Match: 如果不匹配,则发送到error-drop节点处理。

运行数据

Note: the double-pass of the ip4-lookup and ip4-rewrite.

Performance

Test Case

MPPS

Cycles per packet

ethip4-ip4base

18.81

132

ethip4-ip4base-copwhtlistbase

15.12

165

 

Configuration

Note: a new VRF 1 is created which holds the whitelist, which then applied to the interface 1.

sudo vppctl ip_add_del_route 10.10.10.0/24 via 1.1.1.1  sw_if_index 2 resolve-attempts 10 count 1
sudo vppctl ip_table_add_del table 1
sudo vppctl ip_add_del_route 20.20.20.0/24  vrf 1  resolve-attempts 10 count 1    local
sudo vppctl cop_whitelist_enable_disable sw_if_index 1 ip4 fib-id 1
sudo vppctl cop_interface_enable_disable sw_if_index 1

Links

VPP FLOW

VPP Flow增加了vpp的能力来支持流的匹配并采取相关的操作。这些信息用于编程硬件加速,例如网卡上可用的硬件加速,例如Intel® Ethernet Flow Director technology on the Intel® Ethernet Controller X710/XXV710/XL710.

支持

Actions

  • Counts:计数。
  • Mark:将匹配的流与任意数据(如vxlan tunnel)关联,以便在重定向图节点中查找。
  • Buffer Advance:可以用于以太网或者ip头封装预测。
  • Redirect to node:将指定流重定向到指定处理节点。
  • Redirect to queue:将指定流重定向到网卡指定接收队列。
  • Drop: 丢弃指定流。

设计注释:

  • 目前在VPP中仅仅用来加速VXLAN绕过以太网和IP层。
  • 对于那些通过DPDK编程的网络接口,Flow在底层使用DPDK rte_flow API。
  • Redirect to node:值得注意的是,如果您绕过一个处理节点,您就绕过了节点中的所有检查,例如生存时间、CRCS等。

Operational Data

FD.io CSIT numbers for VXLan do not use FD.io Flow support.

Performance

FD.io CSIT numbers for VXLan do not use FD.io Flow support.

Configuration

VPP Classifiers

VPP中最灵活的ACL 方法,VPP允许用户匹配包头的前80个字节中的任何地方。

Configuration

Match an IPv6….

sudo vppctl classify table mask l3 ip6 dst buckets 64
sudo vppctl classify session hit-next 0 table-index 0 match l3 ip6 dst 2001:db8:1::2 opaque-index 42
sudo vppctl set interface l2 input classify intfc host-s0_s1 ip6-table 0

Links

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值