How to Set Ethernet Card Speed in Linux with ethtool

The ethtool command is used to view and change the ethernet device parameters such as speed and duplex. Here's how to use it!

The configuration of your Ethernet card allows your computer to communicate effectively over the network. Ethtool provides much information about Ethernet devices connected to your Linux system.

In addition, you can change ethernet card parameters as required, including auto-negotiation, Speed, Duplex, and Wake-on LAN.

The following information will help you understand how an Ethernet card works.

  • Auto-Negotiation: It is a mechanism that allows a device to choose the best network speed and mode of operation automatically.
  • Speed: By default, it uses maximum speed, and you can change it according to your need.
  • Half Duplex: This allows a device to either send or receive packets at a time.
  • Full Duplex: This allows a device to send and receive packets simultaneously.
  • Wake-on-LAN (WoL): Industry standard protocol allows a computer to be turned on or awakened by a network message.
  • Link detection: This shows the status of the network interface card. If it shows “no,” then try restarting the interface. If the link detection still says “no,” check if there are any issues with the cables connected between the switch and the system.

How to Find Available Network Interfaces on Linux

Firstly you’ll need to know the name of your network interface card. If you’re not sure how to operate with network devices in Linux, we recommend our excellent guide on the subject, “How to Set Static IP Address and Modifying Routing Table on Linux.”

Run the following command from the command terminal:

ip a
How to view the available network interface in Linux

As you can see in the example above, we have many network devices. So, depending on the available devices on your computer, determine which is the network device you want to change the parameters on. In our case, this is enp7s0.

How to Check Network Interface Information on Linux with ethtool

Once you have the Ethernet interface name, you can quickly check its details using the ethtool command.

When you execute the ethtool command with a device name, it displays ethernet card properties such as speed, wake on, duplex, and the link detection status.

sudo ethtool enp7s0
Check network interface information in Linux with ethtool

How to Get Ethernet Card Driver and Firmware Version on Linux with ethtool

You can also check the driver, firmware, and bus details using the ethtool command with the -i option, as shown below.

sudo ethtool -i enp7s0
Check the ethernet card driver and the firmware version in Linux with the ethtool command

How to Change Ethernet Card Settings on Linux with ethtool

The -s option can be used to change the current settings by defining the values for speed, duplex, and auto-negotioation in the following format:

sudo ethtool -s [device_name] speed [10/100/1000] duplex [half/full] autoneg [on/off]Code language: CSS (css)

For example, to set the speed at 100Mb/s, the duplex mode to full, and the auto-negotiation to on, the command would be:

sudo ethtool -s enp7s0 speed 100 duplex full autoneg on

In addition, you can change each option individually:

sudo ethtool -s enp7s0 speed 100
sudo ethtool -s enp7s0 duplex full
sudo ethtool -s enp7s0 autoneg on

Note: Once you change the speed when the adapter is online, it automatically goes offline, and you need to bring it back online using the ifup command.

sudo ifup enp7s0

Please note that if youโ€™ve changed any ethernet card parameters using the ethtool, it will disappear after the next reboot.

How to Persist ethtool Settings Across Reboot

However, after a system restarts, the changes you made with ethtool will be reverted by default.

To make custom settings permanent, you need to update your value in the network configuration file. Depending on your Linux distro, you may need to update this value to the correct file.

For Red Hat-based systems modify the /etc/sysconfig/network-scripts/ifcfg-eth-id file and include a line as shown below:

ETHTOOL_OPTS="speed 100 duplex full autoneg on"Code language: JavaScript (javascript)

For Debian/Ubuntu-based systems you have to modify /etc/network/interfaces file and add your changes as shown below:

post-up ethtool -s enp5s0 speed 100 duplex full autoneg on

Conclusion

You have figured out that this is just a basic introduction to ethtool because it provides many other options not explained above. However, combined with other such tools, this can become one fantastic tool in a sysadmin’s bag of tricks.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%