Home / Alt manpages / dcb-maxrate(8)

  • dcb-maxrate(8)
  • Admin command
  • linux

Set and verify DCB traffic-class maximum rates with dcb maxrate

You will inspect and, if the network device supports it, set the maximum egress rate for each DCB traffic class. The command works with a map from traffic-class numbers 0 through 7 to rates such as 25Gbit. Allow about 15 minutes for a read-only check, or longer if you need to coordinate a live network change.

You need the iproute2 package, a DCB-capable network device, and its interface name. The examples use eth0 as a placeholder. Replace it with the actual device before pressing Enter. Reading settings is normally unprivileged on a suitable system; changing them normally requires root or the relevant network administration capability.

1. Confirm the installed command

This guide follows the installed dcb from iproute2 6.1.0. Check the local binary and its supported syntax:

$ dcb -V
dcb utility, iproute2-6.1.0
$ dcb maxrate help

Usage: dcb maxrate help

Usage: dcb [ -i ] maxrate show dev STRING
           [ tc-maxrate ]

Usage: dcb maxrate set dev STRING
           [ tc-maxrate RATE-MAP ]

The exact package revision may differ on another distribution. The important local interface is the maxrate object, with show and set commands.

2. Inspect the current map

Start with a read-only query. Without a parameter name, show requests the complete maxrate configuration:

$ dcb maxrate show dev eth0
tc-maxrate 0:25Gbit 1:25Gbit 2:25Gbit 3:25Gbit 4:25Gbit 5:25Gbit 6:100Gbit 7:25Gbit

Your output will reflect the device, driver and firmware. The useful shape is tc-maxrate followed by mappings such as 6:100Gbit. The class number is on the left; the maximum rate is on the right.

Checkpoint: record the current output before making a change. It is the simplest recovery reference if you need to restore the previous values.

3. Read rates with ISO prefixes when needed

The top-level -i option toggles between decimal prefixes and ISO/IEC prefixes when rates are displayed. Run both forms if the unit boundary matters to your capacity calculation:

$ dcb -i maxrate show dev eth0
$ dcb maxrate show dev eth0

Do not interpret Gbit as bytes. In this command's rate notation, bit means bits per second and b means bytes per second. The manual also accepts units such as Kbit and Mib. Use the spelling that matches the unit you intend, then verify the displayed map.

4. Set a complete, explicit map

Changing a device's egress limits can affect live traffic. Schedule the change with whoever owns the link, make a note of the old map, and use elevated privileges only for the write:

$ sudo dcb maxrate set dev eth0 tc-maxrate all:25Gbit 6:100Gbit

The all:25Gbit mapping gives every traffic class the same rate, then 6:100Gbit overrides class 6. Traffic classes 0 through 7 are the accepted class indices. The command writes settings to the device; it does not merely prepare a file for a later service restart.

Verify the result immediately:

$ sudo dcb maxrate show dev eth0
tc-maxrate 0:25Gbit 1:25Gbit 2:25Gbit 3:25Gbit 4:25Gbit 5:25Gbit 6:100Gbit 7:25Gbit

If the command prints an error, treat the change as unconfirmed. Run the read command again rather than assuming that part of the map was applied.

5. Change selected classes carefully

A rate map can contain individual class mappings. For a targeted change, name only the class you intend to alter:

$ sudo dcb maxrate set dev eth0 tc-maxrate 6:100Gbit
$ sudo dcb maxrate show dev eth0

Use this form only when you understand how the device handles omitted entries. The safest repeatable configuration is usually a complete map, because it states the desired value for every class rather than relying on existing settings. Do not mix up a class number with a queue number: this command's documented key is a traffic-class index.

6. Restore the previous values

There is no separate undo command in dcb maxrate. Recovery means setting the old map again. For example, to restore the map captured above:

$ sudo dcb maxrate set dev eth0 tc-maxrate all:25Gbit 6:100Gbit
$ sudo dcb maxrate show dev eth0

If your recorded map differs, substitute its exact class and rate pairs. Keep the old output until the restored map has been checked. Do not use a guessed zero rate as an undo operation: that would be a new traffic policy, and the manpage does not define it as a reset.

7. Diagnose an unsupported device

A successful command depends on support from the network driver and device. On a device without the required DCB attribute, a query can fail with an error such as:

$ dcb maxrate show dev lo
Attribute read: Operation not supported

This is not evidence that a maxrate map exists with a hidden default. Check the interface name, confirm that the adapter and driver provide DCB maxrate support, and inspect the kernel and driver logs through your normal operations process. Do not keep retrying a write against an interface that reports the attribute as unsupported.

A failure can also come from a misspelled device, insufficient privilege, an invalid rate, or a malformed map. Check the command's exit status in a script:

if sudo dcb maxrate show dev eth0; then
    printf '%s\n' 'maxrate query succeeded'
else
    status=$?
    printf 'maxrate query failed with status %s\n' "$status" >&2
    exit "$status"
fi

The documented exit status is zero for success and a positive value for failure. Preserve the actual status in automation; do not turn every failure into a claim that the rate is zero.

Done means

  • The installed iproute2 version and target interface are known.
  • The existing tc-maxrate map was read and recorded before any write.
  • Rates were written only after checking the traffic impact and using the required privilege.
  • The post-change query shows the intended class-to-rate mappings.
  • A tested restoration command and the previous map are available if the change must be reversed.