Posted on
Software

ethtool: Display and modify Ethernet device settings

Author
  • User
    Linux Bash
    Posts by this author
    Posts by this author

Mastering Ethernet With Ethtool: Setup, Usage, and Commands

For Linux system administrators and network engineers, the control and configuration of Ethernet devices is a critical task. ethtool stands out as a robust utility enabling users to query and modify Ethernet card settings such as speed, auto-negotiation, and Wake-on-LAN settings. In this blog, we delve into how to install ethtool, showcase its usage, and explain the power it brings in managing network interfaces.

What is Ethtool?

ethtool is a Linux command-line tool that allows you to view and change various parameters related to Ethernet devices. It supports querying and changing settings such as link speed, duplex mode, hardware offload, and more. Whether you're troubleshooting network issues or fine-tuning performance, ethtool provides the necessary insights and control.

Installing Ethtool

The installation process of ethtool varies depending on the Linux distribution you are using. Here’s how to install it across different package managers:

Debian/Ubuntu Systems:

On Debian-based distributions like Ubuntu, use the apt package manager. First, update your package list to ensure you get the latest version of the software:

sudo apt update

Next, install ethtool by running:

sudo apt install ethtool

Fedora Systems:

For Fedora users, the dnf package manager is your tool of choice. As always, start by updating your system:

sudo dnf makecache

Now, install ethtool:

sudo dnf install ethtool

openSUSE Systems:

If you’re running an openSUSE system, you can install ethtool using the zypper package manager:

sudo zypper refresh

Follow it with the installation command:

sudo zypper install ethtool

Usage of Ethtool

With ethtool, you can display and modify settings of Ethernet devices. Below are some common commands and their usage:

Displaying Current Settings

To view the current settings of an Ethernet device, use:

ethtool eth0

Replace eth0 with the appropriate interface identifier as needed.

Changing the Speed and Duplex

To manually set the speed and duplex of a network interface, you can use:

sudo ethtool -s eth0 speed 100 duplex full autoneg off

This command sets the eth0 interface to 100Mb/s with full duplex, and turns off auto-negotiation.

Viewing Statistics

ethtool is also capable of displaying network traffic statistics for the specified network interface:

ethtool -S eth0

This can be invaluable for monitoring and troubleshooting network performance issues.

Enabling or Disabling Features

ethtool allows for the enabling or disabling of specific Ethernet card features, such as Wake-on-LAN. To enable Wake-on-LAN via Magic Packet:

sudo ethtool -s eth0 wol g

Conclusion

ethtool is a versatile tool that is vital for network management on Linux systems. By allowing detailed control and configuration of network interface parameters, it ensures that administrators have the capability to optimise and troubleshoot network connections effectively. Always be sure to check the ethtool man page (man ethtool) or run ethtool --help for more detailed information and options available within the tool.

Now equipped with ethtool, you can confidently manage and optimise your Ethernet settings like a seasoned sysadmin!