FLOWADM(1M) | Maintenance Commands | FLOWADM(1M) |
flowadm add-flow [-t] [-R root-dir] -l link -a attr=value[,...] [-p prop=value[,...]] flow flowadm remove-flow [-t] [-R root-dir] {-l link | flow} flowadm show-flow [-p] [-l link] [-o field[,...]] [flow]
flowadm set-flowprop [-t] [-R root-dir] -p prop=value[,...] flow flowadm reset-flowprop [-t] [-R root-dir] [-p prop[,...]] flow flowadm show-flowprop [-cP] [-l link] [-o field[,...]] [-p prop[,...]] [flow]
The flowadm command allows users to manage networking bandwidth resources for a transport, service, or a subnet. The service is specified as a combination of transport and local port. The subnet is specified by its IP address and subnet mask. The command can be used on any type of data link, including physical links, virtual NICs, and link aggregations.
A flow is defined as a set of attributes based on Layer 3 and Layer 4 headers, which can be used to identify a protocol, service, or a virtual machine. When a flow is identified based on flow attributes, separate kernel resources including layer 2, 3, and 4 queues, their processing threads, and other resources are uniquely created for it, such that other traffic has minimal or zero impact on it.
Inbound and outbound packet are matched to flows in a very fast and scalable way, so that limits can be enforced with minimal performance impact.
The flowadm command can be used to define a flow without imposing any bandwidth resource control. This would result in the traffic type getting its own resources and queues so that it is isolated from rest of the networking traffic for more observable and deterministic behavior.
flowadm is implemented as a set of subcommands with corresponding options. Options are described in the context of each subcommand.
flowadm add-flow [-t] [-R root-dir] -l link -a attr=value[,...] [-p prop=value[,...]] flow
As part of identifying a particular flow, its bandwidth resource can be limited and its relative priority to other traffic can be specified. If no bandwidth limit or priority is specified, the traffic still gets its unique layer 2, 3, and 4 queues and processing threads, including NIC hardware resources (when supported), so that the selected traffic can be separated from others and can flow with minimal impact from other traffic.
-t, --temporary
-R root-dir, --root-dir=root-dir
-l link, --link=link
-a attr=value[,...], --attr=value
-p prop=value[,...], --prop=value[,...]
flowadm remove-flow [-t] [-R root-dir] -l {link | flow}
-t, --temporary
-R root-dir, --root-dir=root-dir
-l link | flow, --link=link | flow
flowadm show-flow [-pP] [-s [-i interval]] [-o field[,...]] [-l link] [flow]
-o field[,...]
flow
link
ipaddr
proto
lport
rport
dsfld
-p, --parsable
-P, --persistent
-l link, --link=link | flow
flowadm set-flowprop [-t] [-R root-dir] -p prop=value[,...] flow
-t, --temporary
-R root-dir, --root-dir=root-dir
-p prop=value[,...], --prop=value[,...]
flowadm reset-flowprop [-t] [-R root-dir] -p [prop=value[,...]] flow
-t, --temporary
-R root-dir, --root-dir=root-dir
-p prop=value[,...], --prop=value[,...]
flowadm show-flowprop [-cP] [-l link] [-p prop[,...]] [flow]
By default, current values are shown. If no properties are specified, all available flow properties are displayed. For each property, the following fields are displayed:
FLOW
PROPERTY
VALUE
DEFAULT
POSSIBLE
Flow properties are documented in the "Flow Properties" section, below.
-c
-P, --persistent
-p prop[,...], --prop=prop[,...]
local_ip[/prefix_len]
If prefix_len is specified, it describes the netmask for a subnet address, following the same notation convention of ifconfig(1M) and route(1M) addresses. If unspecified, the given IP address will be considered as a host address for which the default prefix length for a IPv4 address is /32 and for IPv6 is /128.
remote_ip[/prefix_len]
transport={tcp|udp|sctp|icmp|icmpv6}
local_port
remote_port
dsfield[:dsfield_mask]
The optional dsfield_mask is used to state the bits of interest in the differentiated services field when comparing with the dsfield value. A 0 in a bit position indicates that the bit value needs to be ignored and a 1 indicates otherwise. The mask can range from 0x01 to 0xff. If dsfield_mask is not specified, the default mask 0xff is used. Both the dsfield value and mask must be in hexadecimal.
The following six types of combinations of attributes are supported:
local_ip[/prefixlen]=address remote_ip[/prefixlen]=address transport={tcp|udp|sctp|icmp|icmpv6} transport={tcp|udp|sctp},local_port=port transport={tcp|udp|sctp},remote_port=port dsfield=val[:dsfield_mask]
On a given link, the types of combinations above are mutually exclusive. An attempt to create flows of different types on a given link will fail.
An attribute can be listed only once for each flow. For example, the following command is not valid:
# flowadm add-flow -l vnic1 -a local_port=80,local_port=8080 httpflow
transport and local_port:
TCP, UDP, or SCTP flows can be specified with a local port. An ICMP or ICMPv6 flow that specifies a port is not allowed. The following commands are valid:
# flowadm add-flow -l e1000g0 -a transport=udp udpflow # flowadm add-flow -l e1000g0 -a transport=tcp,local_port=80 \ udp80flow
The following commands are not valid:
# flowadm add-flow -l e1000g0 -a local_port=25 flow25 # flowadm add-flow -l e1000g0 -a transport=icmpv6,local_port=16 \ flow16
maxbw
priority
The command below creates a policy around inbound HTTPS traffic on an HTTPS server so that HTTPS obtains dedicated NIC hardware and kernel TCP/IP resources. The name specified, https-1, can be used later to modify or delete the policy.
# flowadm add-flow -l bge0 -a transport=TCP,local_port=443 https-1 # flowadm show-flow -l bge0 FLOW LINK IPADDR PROTO LPORT RPORT DSFLD https1 bge0 -- tcp 443 -- --
Example 2 Modifying an Existing Policy to Add Bandwidth Resource Control
The following command modifies the https-1 policy from the preceding example. The command adds bandwidth control and give the policy a high priority.
# flowadm set-flowprop -p maxbw=500M,priority=high https-1 # flowadm show-flow https-1 FLOW LINK IPADDR PROTO LPORT RPORT DSFLD https-1 bge0 -- tcp 443 -- -- # flowadm show-flowprop https-1 FLOW PROPERTY VALUE DEFAULT POSSIBLE https-1 maxbw 500 -- -- https-1 priority high -- low,medium,high
Example 3 Limiting the UDP Bandwidth Usage
The following command creates a policy for UDP protocol so that it cannot consume more than 100Mbps of available bandwidth. The flow is named limit-udp-1.
# flowadm add-flow -l bge0 -a transport=UDP -p maxbw=100M, \ priority=low limit-udp-1
Example 4 Setting Policy, Making Use of dsfield Attribute
The following command sets a policy for EF PHB (DSCP value of 101110 from RFC 2598) with a bandwidth of 500 Mbps and a high priority. The dsfield value for this flow will be 0x2e (101110) with the dsfield_mask being 0xfc (because we want to ignore the 2 least significant bits).
# flowadm add-flow -l bge0 -a dsfield=0x2e:0xfc \ -p maxbw=500M,priority=high efphb-flow
>0
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | Committed |
February 26, 2020 |