devlink-port - Linux


devlink-port is a versatile Linux command used for managing and configuring network ports on NIC (Network Interface Card) devices. It offers comprehensive control over port parameters, enabling users to diagnose and resolve network issues, optimize performance, and ensure network connectivity.


devlink-port [options] [device] [port]


| Option | Description |
| --help | Displays help information |
| -V, --version | Prints the version number |
| -j, --json | Outputs results in JSON format |
| -o, --object | Parses arguments as a JSON object |
| --dump-tag | Dumps tag info |
| -p, --port | Port identifier |
| --set | Sets port attributes |
| --get | Gets port attributes |
| --add | Adds a port |
| --delete | Deletes a port |
| --eswitch | Specifies the eswitch for the given dev |
| --bridge | Specifies the bridge for the given dev |
| --reset | Resets port attributes |
| --trace | Dumps trace data |
| --stats | Prints port statistics |
| --version-info | Outputs version info |


Get port information:

devlink-port -j show dev eth0

Enable or disable port:

devlink-port set dev eth0 port 0 admin_state enabled
devlink-port set dev eth0 port 0 admin_state disabled

Set port speed:

devlink-port set dev eth0 port 0 speed 10000

Add a new port:

devlink-port add dev eth0 port 1

Delete a port:

devlink-port delete dev eth0 port 1

Reset port attributes to defaults:

devlink-port reset dev eth0 port 0

Common Issues

Permission denied error: Ensure that the user running the command has root privileges.

Device not found error: Check if the specified device is present and accessible.


devlink-port can be combined with other Linux commands for advanced tasks, such as:

ip link show | devlink-port -j show --port | jq '.[] | select(.netdev == "eth0")'

This command chain combines ip link, devlink-port, and jq to display detailed information for port 0 on device eth0.

Related Commands

  • ethtool: Controls Ethernet network card settings
  • ip link: Configures network interfaces
  • tc: Controls traffic flow and network queuing