openvswitch--OpenFlow 流表设置

2023-11-08

流规则组成

每条流规则由一系列字段组成,分为基本字段条件字段动作字段三部分:

  • 基本字段包括生效时间duration_sec、所属表项table_id、优先级priority、处理的数据包数n_packets,空闲超时时间idle_timeout等,空闲超时时间idle_timeout以秒为单位,超过设置的空闲超时时间后该流规则将被自动删除,空闲超时时间设置为0表示该流规则永不过期,idle_timeout将不包含于ovs-ofctl dump-flows brname的输出中。

  • 条件字段包括输入端口号in_port、源目的mac地址dl_src/dl_dst、源目的ip地址nw_src/nw_dst、数据包类型dl_type、网络层协议类型nw_proto等,可以为这些字段的任意组合,但在网络分层结构中底层的字段未给出确定值时上层的字段不允许给确定值,即一条流规则中允许底层协议字段指定为确定值,高层协议字段指定为通配符(不指定即为匹配任何值),而不允许高层协议字段指定为确定值,而底层协议字段却为通配符(不指定即为匹配任何值),否则,ovs-vswitchd 中的流规则将全部丢失,网络无法连接。

  • 动作字段包括正常转发normal、定向到某交换机端口output:port、丢弃drop、更改源目的mac地址mod_dl_src/mod_dl_dst等,一条流规则可有多个动作,动作执行按指定的先后顺序依次完成。

条件字段介绍

in_port=port
Matches OpenFlow port port
dl_vlan=vlan
Matches IEEE 802.1q Virtual LAN tag vlan.
dl_vlan_pcp=priority
Matches IEEE 802.1q Priority Code Point (PCP) priority, which is specified as a value between 0 and 7, inclusive. A higher value indicates a higher frame priority level.
dl_src=xx:xx:xx:xx:xx:xx
dl_dst=xx:xx:xx:xx:xx:xx
Matches an Ethernet source (or destination) address specified as 6 pairs of hexadecimal digits delimited by colons (e.g. 00:0A:E4:25:6B:B0).
dl_src=xx:xx:xx:xx:xx:xx/xx:xx:xx:xx:xx:xx
dl_dst=xx:xx:xx:xx:xx:xx/xx:xx:xx:xx:xx:xx
Matches an Ethernet destination address specified as 6 pairs of hexadecimal digits delimited by colons (e.g. 00:0A:E4:25:6B:B0), with a wildcard mask following the slash.
01:00:00:00:00:00 Match only the multicast bit. Thus, dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 matches all multicast (including broadcast) Ethernet packets, and dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 matches all unicast Ethernet packets.
ff:ff:ff:ff:ff:ff Exact match (equivalent to omitting the mask).
00:00:00:00:00:00 Wildcard all bits (equivalent to dl_dst=*.)
dl_type=ethertype
Matches Ethernet protocol type ethertype, which is specified as an integer between 0 and 65535
nw_src=ip[/netmask]
nw_dst=ip[/netmask]
When dl_type is 0x0800 (possibly via shorthand, e.g. ip or tcp), matches IPv4 source (or destination) address ip, which may be specified as an IP address or host name
When dl_type=0x0806 or arp is specified, matches the ar_spa or ar_tpa field, respectively, in
ARP packets for IPv4 and Ethernet.
When dl_type=0x8035 or rarp is specified, matches the ar_spa or ar_tpa field, respectively, in
RARP packets for IPv4 and Ethernet.
nw_proto=proto
When ip or dl_type=0x0800 is specified, matches IP protocol type proto, which is specified as a decimal number between 0 and 255, inclusive (e.g. 1 to match ICMP packets or 6 to match TCP packets).
When ipv6 or dl_type=0x86dd is specified, matches IPv6 header type proto, which is specified as a decimal number between 0 and 255, inclusive (e.g. 58 to match ICMPv6 packets or 6 to match TCP).
When arp or dl_type=0x0806 is specified, matches the lower 8 bits of the ARP opcode.
When rarp or dl_type=0x8035 is specified, matches the lower 8 bits of the ARP opcode.
nw_tos=tos
Matches IP ToS/DSCP or IPv6 traffic class field tos, which is specified as a decimal number between 0 and 255, inclusive.
nw_ecn=ecn
Matches ecn bits in IP ToS or IPv6 traffic class fields, which is specified as a decimal number between 0 and 3, inclusive.
nw_ttl=ttl
Matches IP TTL or IPv6 hop limit value ttl, which is specified as a decimal number between 0 and 255, inclusive.
tp_src=port
tp_dst=port
When dl_type and nw_proto specify TCP or UDP, tp_src and tp_dst match the UDP or TCP source or destination port port
icmp_type=type
icmp_code=code
When dl_type and nw_proto specify ICMP or ICMPv6, type matches the ICMP type and code matches the ICMP code.
table=number
If specified, limits the flow manipulation and flow dump commands to only apply to the table with the given number between 0 and 254.
vlan_tci=tci[/mask]
Matches modified VLAN TCI tci. If mask is omitted, tci is the exact VLAN TCI to match; if mask is specified, then a 1-bit in mask indicates that the corresponding bit in tci must match exactly, and a 0-bit wildcards that bit.
ip_frag=frag_type
When dl_type specifies IP or IPv6, frag_type specifies what kind of IP fragments or non-fragments to match.
The following values of frag_type are supported:
no Matches only non-fragmented packets.
yes Matches all fragments.
first Matches only fragments with offset 0.
later Matches only fragments with nonzero offset.
not_later Matches non-fragmented packets and fragments with zero offset.
arp_sha=xx:xx:xx:xx:xx:xx
arp_tha=xx:xx:xx:xx:xx:xx
When dl_type specifies either ARP or RARP, arp_sha and arp_tha match the source and target hardware address, respectively.
tun_id=tunnel-id[/mask]
Matches tunnel identifier tunnel-id. Only packets that arrive over a tunnel that carries a key (e.g. GRE with the RFC 2890 key extension and a nonzero key value) will have a nonzero tunnel ID.

动作字段介绍

output:port
Outputs the packet to port
output:src[start..end]
Outputs the packet to the OpenFlow port number read from src, which must be an NXM field as described above. For example, output:NXM_NX_REG0[16..31] outputs to the OpenFlow port number written in the upper half of register 0.
enqueue:port:queue
Enqueues the packet on the specified queue within port port
normal
Subjects the packet to the device’s normal L2/L3 processing.
flood
Outputs the packet on all switch physical ports other than the port on which it was received and any ports on which flooding is disabled
all
Outputs the packet on all switch physical ports other than the port on which it was received.
controller(key=value…)
Sends the packet to the OpenFlow controller as a ‘‘packet in’’ message. The supported key-value pairs are:
max_len=nbytes : Limit to nbytes the number of bytes of the packet to send to the controller. By default the entire packet is sent.
reason=reason: Specify reason as the reason for sending the message in the ‘‘packet in’’ message. The supported reasons are action (the default), no_match, and invalid_ttl.
id=controller-id : Specify controller-id
in_port
Outputs the packet on the port from which it was received.
drop
Discards the packet, so no further processing or forwarding takes place.
mod_vlan_vid:vlan_vid
Modifies the VLAN id on a packet.
mod_vlan_pcp:vlan_pcp
Modifies the VLAN priority on a packet.
strip_vlan
Strips the VLAN tag from a packet if it is present.
push_vlan:ethertype
Push a new VLAN tag onto the packet.
push_mpls:ethertype
If the packet does not already contain any MPLS labels, changes the packet’s Ethertype to ethertype, which must be either the MPLS unicast Ethertype 0x8847 or the MPLS multicast Ethertype 0x8848, and then pushes an initial label stack entry.
pop_mpls:ethertype
Strips the outermost MPLS label stack entry.
mod_dl_src:mac
Sets the source Ethernet address to mac.
mod_dl_dst:mac
Sets the destination Ethernet address to mac.
mod_nw_src:ip
Sets the IPv4 source address to ip.
mod_nw_dst:ip
Sets the IPv4 destination address to ip.
mod_tp_src:port
Sets the TCP or UDP source port to port.
mod_tp_dst:port
Sets the TCP or UDP destination port to port.
mod_nw_tos:tos
Sets the IPv4 ToS/DSCP field to tos, which must be a multiple of 4 between 0 and 255.
resubmit([port],[table])
Re-searches this OpenFlow flow table (or the table whose number is specified by table) with the in_port field replaced by port (if port is specified)
set_tunnel:id
set_tunnel64:id
If outputting to a port that encapsulates the packet in a tunnel and supports an identifier (such as GRE), sets the identifier to id.
set_queue:queue
Sets the queue that should be used to queue when packets are output.
pop_queue
Restores the queue to the value it was before any set_queue actions were applied.
dec_ttl
dec_ttl[(id1,id2)]
Decrement TTL of IPv4 packet or hop limit of IPv6 packet.
set_mpls_ttl:ttl
Set the TTL of the outer MPLS label stack entry of a packet. ttl should be in the range 0 to 255 inclusive.
dec_mpls_ttl
Decrement TTL of the outer MPLS label stack entry of a packet.
move:src[start..end]−>dst[start..end]
Copies the named bits from field src to field dst. src and dst must be NXM field names as defined in nicira−ext.h, e.g. NXM_OF_UDP_SRC or NXM_NX_REG0.
Examples: move:NXM_NX_REG0[0..5]−>NXM_NX_REG1[26..31] copies the six bits numbered 0 through 5, inclusive, in register 0 into bits 26 through 31, inclusive; move:NXM_NX_REG0[0..15]−>NXM_OF_VLAN_TCI[] copies the least significant 16 bits of register 0 into the VLAN TCI field.
load:value−>dst[start..end]
Writes value to bits start through end, inclusive, in field dst.
Example: load:55−>NXM_NX_REG2[0..5] loads value 55 (bit pattern 110111) into bits 0 through 5, inclusive, in register 2.
push:src[start..end]
Pushes start to end bits inclusive, in fields on top of the stack.
Example: push:NXM_NX_REG2[0..5] push the value stored in register 2 bits 0 through 5, inclusive, on to the internal stack.
pop:dst[start..end]
Pops from the top of the stack, retrieves the start to end bits inclusive, from the value popped and store them into the corresponding bits in dst.
Example: pop:NXM_NX_REG2[0..5] pops the value from top of the stack. Set register 2 bits 0 through 5, inclusive, based on bits 0 through 5 from the value just popped.
set_field:value−>dst
Writes the literal value into the field dst, which should be specified as a name used for matching.
Example: set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa−>ipv6_src
learn(argument[,argument]…)
This action adds or modifies a flow in an OpenFlow table, similar to ovs−ofctl −−strict mod−flows. The arguments specify the flow’s match fields, actions, and other properties, as follows
idle_timeout=seconds
hard_timeout=seconds
priority=value
These key-value pairs have the same meaning as in the usual ovs−ofctl flow syntax.
fin_idle_timeout=seconds
fin_hard_timeout=seconds
Adds a fin_timeout action with the specified arguments to the new flow.
table=number
The table in which the new flow should be inserted. Specify a decimal number between 0 and 254. The default, if table is unspecified, is table 1.
field=value
field[start..end]=src[start..end]
field[start..end]
Adds a match criterion to the new flow.
load:value−>dst[start..end]
load:src[start..end]−>dst[start..end]
Adds a load action to the new flow.
output:field[start..end]
Add an output action to the new flow’s actions, that outputs to the OpenFlow port taken from field[start..end], which must be an NXM field as described above.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

openvswitch--OpenFlow 流表设置 的相关文章

随机推荐

  • 【安装指南】Ubuntu18 安装FFmpeg

    安装FFmpeg 下载FFmpeg 终端输入 git clone https github com FFmpeg FFmpeg git 避免git下载太慢 git clone https github com FFmpeg FFmpeg g
  • Apache服务一简介与安装

    一 Apache介绍 1 什么是Apache 2 Apache的特性 二 安装Apache服务 1 编译安装http服务 2 启动服务 3 关闭防火墙 se 4 通过网页查看 4 1修改首页内容 4 2网页查看 一 Apache介绍 1 什
  • matlab 保存不了文件,关于matlab文件无法保存的原因(转)

    mdl文件在6 5里面做的 但是到了7 0里面却打不开 下面就是相关信息 Warning Unable to load model file d MATLAB7 work mdl Run bdclose all set param 0 Ch
  • MCU端 Boot+App设计方案

    概述 本文结合当前主流主机厂的升级规范来介绍不用MCU升级方案及其优缺点 除了本文提及的方案外还有很多其他的升级方案 升级方案的设定要考虑到客户需求以及硬件资源等因素 目前主流的客户需求 要求存储区划分要有Boot段 Config段 App
  • 刷个宇宙题:剑指offerⅡ:02整数系列——二进制加法、03前 n 个数字二进制中 1 的个数

    题目 解题 还算简单的思路 只要注意a i 有可能会溢出 用a at i 避免溢出的情况 还有一些string的api需要多用记忆一下 前 n 个数字二进制中 1 的个数 class Solution public vector
  • Python基础内容四 :适合刚入门的朋友看的教程

    13 Python标准库 Python标准库是随Pthon附带安装的 包含了大量极其有用的模块 我们主要了解下sys和os就够了 13 1 sys模块 sys模块主要是针对与Python解释器相关的变量和方法 不是主机操作系统 sys ar
  • TCP参数参数调优

    前言 TCP 性能的提升不仅考察 TCP 的理论知识 还考察了对于操心系统提供的内核参数的理解与应用 TCP 协议是由操作系统实现 所以操作系统提供了不少调节 TCP 的参数 如何正确有效的使用这些参数 来提高 TCP 性能是一个不那么简单
  • SpringBoot整合微信支付(Native最详细)

    一 微信支付产品介绍 1 付款码支付 用户展示微信钱包内的 付款码 给商家 商家扫描后直接完成支付 适用于线下面对面收银的场景 2 JSAPI支付 线下场所 商户展示一个支付二维码 用户使用微信扫描二维码后 输入需要支付的金额 完成支 付
  • Java容器常见面试题汇总

    目录 1 java 容器都有哪些 2 Collection 和 Collections 有什么区别 3 List Set Map 之间的区别是什么 4 ArrayList 和 LinkedList 的区别是什么 5 说一说ArrayList
  • 基于Linux操作系统下的Shell排序算法

    一 Shell排序算法原理 希尔排序 Shell Sort 是 DLShell 于1959 年提出来的一种排序算法 在这之前排序算法的时间复杂度基本都是 O n2 的 希尔排序算法是突破这个时间复杂度的第一批算法之一 直接插入排序 应该说
  • 牛客网在线编程输入输出

    多行输入 输入第一个数据为接下来要输入的行数 接下来的几行每一行仅有一个数字 const readline require readline const rl readline createInterface input process s
  • Visual Assist X 10.6.1837.0 Cracked

    http download csdn net download dengai 2918948 http download csdn net detail u013127159 6721815
  • 设计模式--访问者模式

    访问者模式 属于行为型模式基本原理 元素类的执行算法随着访问者改变而改变 主要流程 1 创建元素类 内有不同的执行算法 根据不同的访问者选择不同的执行算法 2 创建访问类 实现不同的访问派生类 将自身传入元素类的执行算法 include
  • Linux中opengl库叫什么名字,Linux下的OpenGL——Mesa和GLX简介

    一 什么是Mesa和GLX 众所周知 OpenGL作为图形界的工业标准 其仅仅定义了一组2D和3D图形接口API 而对于窗口管理 IO消息响应等并没有规定 也就是说 OpenGL依赖各平台提供用于渲染的context以及具体实现方式 而各平
  • 时间序列数据的正态性检验

    目录 正态分布 柯尔莫可洛夫 斯米洛夫检验 Kolmogorov Smirnov检验原理 工具箱介绍 Lilliefors检验 雅各 贝拉检验 安得森 达令检验 正态分布 y1中100是 5是 而不是平方 Matlab中legend的用法总
  • 管理数据库用户

    紫色代表一级目录 粉红代表二级目录 蓝色代表三级目录 红色代表关键字 橙色代表说明 管理过程 创建用户 Oracle中 创建用户的语法 授予用户权限的语法 Microsoft SQL Server中 创建用户 账户的语法 把用户添加到数据库
  • Unity 云雾shader

    先上效果图 Shader Demo MainCloud Properties LightIntensity 光照强度 Range 0 75 1 1 MainColor MainCol Color 0 6 0 6 0 6 1 MainTex
  • 什么是反向跟单?反向跟单怎么运作?

    所谓反向跟单 顾名思义 就是依据跟单样本的下单方向 反方向下单交易 一 反向原理 基于交易市场的 二八定律 即 二盈八亏 或 一盈二平七亏 依据市场的交易行为 进行反方向操作 锁定盈利 二 反跟途径 运用计算机技术 搭建一套虚拟交易端软件
  • ChatGPT/GPT4开源“平替”汇总

    寻找那些ChatGPT GPT4开源 平替 们 ChatGPT爆火出圈 国内很多高校 研究机构和企业都发出类似ChatGPT的发布计划 ChatGPT没有开源 复现难度极大 即使到现在GPT3的完全能力也没有任何一个单位或者企业进行了复现
  • openvswitch--OpenFlow 流表设置

    流规则组成 每条流规则由一系列字段组成 分为基本字段 条件字段和动作字段三部分 基本字段包括生效时间duration sec 所属表项table id 优先级priority 处理的数据包数n packets 空闲超时时间idle time