Getting Data Centre Bridging wrong on a live interface can starve one traffic class while flooding another, so read before you write. This guide uses dcb to inspect DCB settings on a network interface, read its per-traffic-class mappings, and make one targeted change without overwriting unrelated values.
Allow 15 minutes for an existing DCB-capable interface, plus time to confirm the network design before changing anything. This guide describes the installed dcb from iproute2 6.1.0, package version 6.1.0-1ubuntu6.4 on this machine. DCB support is supplied by the network driver and kernel. A normal read does not need root; changing a device normally needs elevated privileges and can affect live traffic.
Check the binary and version first. This is read-only:
$ command -v dcb
/usr/sbin/dcb
$ dcb -V
dcb utility, iproute2-6.1.0
Set a shell variable to the interface that your DCB design names. Replace the placeholder with a real interface name. Do not use lo as a test: the loopback device does not provide the DCB attributes.
$ IFACE='ens5'
$ ip -br link show dev "$IFACE"
ens5 UP ...
If the interface name is wrong, stop and correct it. A successful command against the wrong physical port can still produce a perfectly valid, irrelevant result.
The top-level help is the reliable way to see what this installed build exposes:
$ dcb help
Usage: dcb [ OPTIONS ] OBJECT { COMMAND | help }
dcb [ -f | --force ] { -b | --batch } filename [ -n | --netns ] netnsname
where OBJECT := { app | buffer | dcbx | ets | maxrate | pfc }
The primary objects are application priorities (app), port buffers (buffer), Enhanced Transmission Selection (ets), per-traffic-class maximum rates (maxrate) and Priority-based Flow Control (pfc). This 6.1.0 build also lists dcbx in help, although the installed dcb(8) page documents the five objects above. Check the help on the host where you are working before copying a command between distributions.
Ask an object for its exact syntax before using it:
$ dcb ets help
Usage: dcb ets show dev STRING
[ willing ] [ ets-cap ] [ cbs ] [ tc-tsa ] ...
Usage: dcb ets set dev STRING
[ willing { on | off } ] ...
The abbreviated output above is shown only to highlight the command shape. The complete help lists every field accepted by this version.
Start with one object relevant to your design. ETS shows traffic-class selection and bandwidth-related settings. Reading does not change the device:
$ dcb ets show dev "$IFACE"
...
The output is driver- and device-specific, so do not treat a particular order or set of fields as universal. For machine-readable output, add -j; add -p when you want indented JSON:
$ dcb -p -j ets show dev "$IFACE"
...
Capture the output before changing anything. It is your practical recovery record. You can also inspect other areas:
$ dcb app show dev "$IFACE"
$ dcb buffer show dev "$IFACE"
$ dcb maxrate show dev "$IFACE"
$ dcb pfc show dev "$IFACE"
If a command returns Attribute read: Operation not supported, the interface or its driver does not expose that DCB attribute. That is a capability result, not a reason to retry the same command with sudo.
DCB commonly represents one value per traffic class or priority. The syntax is a series of KEY:VALUE pairs. Keys and values depend on the object; ETS traffic classes and priorities are normally numbered 0 to 7.
Unspecified array elements are queried from the kernel and retained. Pairs are applied from left to right, so a later pair wins. The special key all applies a value to every element before later specific pairs override selected elements.
# Illustrative mapping syntax from dcb(8), not a device change
$ dcb ets set dev "$IFACE" tc-bw all:100 0:40 7:10
That command would set all traffic classes to 100, then set class 0 to 40 and class 7 to 10. It is not safe to paste without a confirmed bandwidth plan. More narrowly scoped mappings are easier to review:
$ dcb ets set dev "$IFACE" tc-bw 0:40
For a live interface, this is a configuration change and needs elevated privileges:
$ sudo dcb ets set dev "$IFACE" tc-bw 0:40
Do not confuse a traffic-class bandwidth percentage with a link rate. The accepted range and meaning are defined by the object's help and the device's DCB implementation. Confirm both before applying a production value.
Immediately read back the field you changed:
$ dcb ets show dev "$IFACE" tc-bw
...
$ dcb -j ets show dev "$IFACE" tc-bw
...
Compare the result with your baseline, not with a guessed example output. If it is wrong, reapply the original mapping recorded in the baseline. There is no universal undo value: the correct recovery command is the previous device-specific configuration.
Warning: for a change involving PFC, treat the same workflow as service-sensitive. PFC can alter pause behaviour and interact with switch configuration:
$ dcb pfc show dev "$IFACE" prio-pfc
$ sudo dcb pfc set dev "$IFACE" prio-pfc 3:on
$ dcb pfc show dev "$IFACE" prio-pfc
Only enable PFC for a priority that the connected switch and host configuration expect. If the read-back is not the intended value, restore the saved mapping, then check the switch side and kernel logs through your normal operational process.
dcb can read commands from a file or standard input with -b. In ordinary batch mode, the first failure stops processing. -f continues after errors but returns non-zero if any command failed. That is useful for deliberately best-effort work, not for hiding a partial DCB rollout.
$ cat dcb-check.batch
ets show dev ens5
pfc show dev ens5
$ dcb -b dcb-check.batch
Batch input is command text, not a shell script. Keep device names and values explicit, review the file, and test each line interactively before adding state-changing commands. If the target is in another network namespace, the installed syntax also supports -n NETNS; verify the namespace and interface from inside that network context before making changes.
ip -br link.all: applies first and later pairs override it.show command before changing state.KEY:VALUE mapping instead of guessing defaults.