netshaper8
Show / manipulate network device hardware shaping configuration
Usage
netshaper [OPTIONS]
{COMMAND | help}
OPTIONS :=
{-V
[ersion] | -c
[olor] | -help}
netshaper set
dev
DEV
handle
scope
HANDLE_SCOPE
[id
HANDLE_ID]
[bw-min
BW_MIN]
[bw-max
BW_MAX]
[weight
WEIGHT]
netshaper {show | delete}
dev
DEV
handle
scope
HANDLE_SCOPE
[id
HANDLE_ID]
netshaper group
dev
DEV
handle
scope
{node | netdev}
[id
HANDLE_ID]
[parent
scope
{netdev
[id
PARENT_ID] | node
id
PARENT_ID}]
[bw-min
BW_MIN]
[bw-max
BW_MAX]
[weight
WEIGHT]
leaves
LEAF_SPEC
[LEAF_SPEC ...]
LEAF_SPEC :=
scope
queue
id
ID
[weight
WEIGHT]
[priority
PRIO]
Overview
netshaper allows configuration and management of hardware rate limiting (shaping) capabilities available on network devices. The API provides control over shapers at different levels including network devices, queues, and scheduling nodes, enabling manipulation of the device's scheduling tree.
Each shaper is uniquely identified within a device by a handle, which consists of a scope and an optional id. Depending on the scope value, shapers are attached to specific hardware objects:
netdev-
Shapers attached to the entire network device. The id parameter is optional for this scope (defaults to 0 if not specified).
queue-
Shapers attached to specific device queues. The id parameter is required and specifies the queue number.
node-
Intermediate scheduling nodes that can be placed at arbitrary locations in the scheduling tree. The id parameter is required for
set,show, anddeletecommands. For thegroupcommand it is optional; if omitted, the kernel auto-assigns one.
Commands
netshaper set
- Create or update a shaper configuration
Creates or updates a shaper with the specified parameters. At least one of bw-min, bw-max, or weight must be provided. The id parameter is required for queue and node scopes and optional for netdev scope.
netshaper show
- Display shaper information
Shows the current configuration of the specified shaper, including bandwidth limits, weight, and parent information.
netshaper delete
- Remove a shaper configuration
Removes the specified shaper configuration from the device.
netshaper group
- Create a scheduling hierarchy
Creates a scheduling group by binding one or more queue leaf shapers to a netdev or node handle in a single operation. The command specifies the target handle, its parent, optional bandwidth and weight parameters, and the set of queue leaves to attach.
Parameters
devDEV-
Specifies the network device name on which to operate.
handle-
Defines the shaper handle consisting of:
scopeHANDLE_SCOPE-
The shaper scope, which can be:
netdev(device-level shaper),queue(queue-level shaper), ornode(scheduling node shaper).
idHANDLE_ID-
Numeric identifier for the shaper. Required for
queueandnodescopes. Optional fornetdevscope (defaults to 0). For thegroupcommand, node id may be omitted to let the kernel auto-assign one.
bw-minBW_MIN-
Minimum guaranteed bandwidth for the shaper. Accepts values with suffixes:
kbit,mbit,gbitfor kilobits, megabits, and gigabits per second respectively.
bw-maxBW_MAX-
Maximum bandwidth limit for the shaper. Accepts the same suffixes as
bw-min.
weightWEIGHT-
Scheduling weight for the shaper, used for weighted fair sharing among siblings under the same parent node. Value is an unsigned integer.
parent-
Defines the parent for the
groupcommand. The parent scope must benodeornetdev;queueis not valid as a parent scope. For parent scopenode, id is required. For parent scopenetdev, id is optional. When omitted, the parent is inherited from the leaves' current parent, which requires all leaves to share the same parent.
leaves-
Specifies one or more leaf shapers to attach to the group. Each leaf must use scope
queue; no other scope is accepted for leaves. Each leaf is given as scope queue id ID, with optionalweightandpriorityparameters for per-queue scheduling within the group. Multiple leaves can be specified in sequence.
Options
-
-V, -Version -
Print the version of the
netshaperutility and exit.
-c[color] = {always|auto|never}-
Configure color output. If the parameter is omitted or
always, color output is enabled regardless of stdout state. If the parameter isauto, stdout is checked to be a terminal before enabling color output. If the parameter isnever, color output is disabled. If specified multiple times, the last one takes precedence.
-
-help -
Display usage information and exit.
Examples
- Example 1: Create a device-level shaper
-
# netshaper set dev foo handle scope netdev bw-max 10gbit
Creates a netdev-scoped shaper with maximum bandwidth of 10 Gbit/s.
- Example 2: Set bandwidth and weight on a queue shaper
-
# netshaper set dev foo handle scope queue id 0 \ bw-min 1gbit bw-max 5gbit weight 10Creates a queue-scoped shaper on queue 0 with minimum/maximum bandwidth limits and a scheduling weight.
- Example 3: Show shaper configuration
-
# netshaper show dev foo handle scope netdev
Displays the current shaper configuration for the specified device and handle.
- Example 4: Create a scheduling hierarchy with group
-
# netshaper group dev foo handle scope node \ parent scope netdev bw-max 10gbit \ leaves scope queue id 0 weight 3 \ scope queue id 1 weight 2Creates a node shaper under the netdev parent, grouping queues 0 and 1 as leaves. The 10 Gbit/s cap applies to the node itself.
- Example 5: Delete shaper configuration
-
# netshaper delete dev foo handle scope netdev
Removes the specified shaper configuration.
Notes
- •
-
For
netdevscope, the id parameter is optional and defaults to 0 if not specified.
- •
-
For
queueandnodescopes, the id parameter is required. For thegroupcommand, node id may be omitted to let the kernel auto-assign one.
- •
-
Bandwidth values support standard suffixes:
kbit(kilobits per second),mbit(megabits per second),gbit(gigabits per second).
- •
-
The
groupcommand attaches queue leaves to a netdev or node handle in a single atomic operation.