devlink-rate - Linux


Overview

devlink-rate is a Linux command-line tool used to set, get, or print information about link rates for a specified Ethernet device. It provides a convenient way to configure and monitor network links in Linux environments.

Syntax

devlink-rate [options] <device>

Options/Flags

| Option | Description | Default |
|—|—|—|
| -s, –show | Display the current link rate | No |
| -r, –set | Set the link rate | – |
| -p, –print | Print all supported link rates | No |
| -h, –help | Display help and usage information | – |
| -V, –version | Display version information | – |
| -d, –devlink-version | Display devlink version information | – |

Examples

Display current link rate:

devlink-rate -s eth0

Set link rate to 1000Mbps:

devlink-rate -r 1000 eth0

Print all supported link rates:

devlink-rate -p eth0

Common Issues

  • Ensure that the Ethernet device specified in <device> is valid and exists.
  • If setting the link rate fails, check if the specified rate is supported by the device.
  • If devlink-rate fails with a "Permission denied" error, the user may not have sufficient privileges to configure the device.

Integration

devlink-rate can be integrated with other Linux commands and scripts for advanced network management tasks, such as:

  • Use grep to filter the output of devlink-rate -p to display only specific rates.
  • Combine with bash loops to set different rates for multiple devices.
  • Integrate into scripts for automating network configuration based on specific criteria.

Related Commands

  • ethtool: Used to configure and display general Ethernet device information.
  • ip link: Used to manage network interfaces and links.
  • Devlink: Official documentation for the Linux devlink library.