How To Change Speed & Duplex of Ethernet Card in Linux with Ethtool Command

Introduction

The ethtool command is a powerful tool used to configure and manage Ethernet network interfaces in Linux. It can be used to change the speed and duplex settings of an Ethernet card. This tutorial will explain how to use the ethtool command to change the speed and duplex settings of an Ethernet card in Linux. It will also provide some examples of how to use the command.

How To Change Speed & Duplex of Ethernet Card in Linux with Ethtool Command

1. First, check the current speed and duplex settings of the Ethernet card with the ethtool command.

$ ethtool eth0

2. To change the speed and duplex settings of the Ethernet card, use the following command.

$ sudo ethtool -s eth0 speed 10 duplex full

3. To verify the new settings, use the ethtool command again.

$ ethtool eth0

Introduction

The configuration of your Ethernet Card defines how effectively your servers communicate.

It is necessary to understand how Auto-Negotiation, Speed, and Duplex settings affect the transfer of data to maintain network connectivity with minimal effort.

This article will show you how to change Speed, Duplex, and Auto-Negotiation settings in Linux (CentOS) with ethtool commands.

tutorial on changing speed, duplex and auto-negation of NIC card

Prerequisites

  • Command-line/terminal window
  • A user account with root or sudo privileges
  • The Ethtool configuration tool installed

Half Duplex, Full Duplex, and Auto-Negotiation

Half-duplex mode allows a device to either send or receive packets in turn. A device set to this mode cannot perform both actions at the same time.

When a device’s mode is at full-duplex, it can also send and receive packets simultaneously.

visual representation of full duplex and half duplex concept

Auto-Negotiation is a mechanism by which a device automatically chooses the best performing transmission mode based on its counterparts’ characteristics. It is recommended to keep Auto-Negotiation enabled as it allows devices to choose the most efficient means for the transfer of data.

What is a Duplex Mismatch?

When a device, with enabled auto-negotiation, connects to a device that is not using this signaling method, the process does not work. The end of the connection with an active auto-negotiation is still able to detect the speed of the other end, but cannot correctly detect the duplex mode. As a rule, the auto-negotiating end of the connection is going to use half-duplex while the other end might be at full-duplex. This situation is considered a duplex mismatch.

A duplex mismatch does not stop communication completely. Single packets and small amounts of data do not cause immediate issues. However, when a large amount of data is sent from either end, the speed drops significantly. The connection is working, but the performance is reduced as the data transfer rate is asymmetrical and might lead to packet loss.

How to Use Ethtool Command to Configure NIC Settings

Ethtool is a Network Interface Card configuration command that allows you to retrieve information and change your NIC settings. These settings include Speed, Duplex, Auto-Negotiation, and many other parameters.

To proceed, you’ll need to know the name of your network interface card.

To find the name of your network interface card, run the following command from the command terminal:

ifconfig

The output provides the name of the device interface card. To learn more about this command, read our guide How to Install and Use ifconfig.

ifconfig command used to find device name

In the above example, the name of the device is enp0s3.

Now that you have determined the name of the device, check the current Speed, Auto-Negotiation, and Duplex mode settings with the command: ethtool devicename.

In our specific example the command is:

ethtool enp0s3

The output shows that the current speed is 1000Mb/s, that the Duplex is at Full, and that Auto-Negotiation is turned on.

Terminal screen displays the status of speed, auto negotiation and duplex

Ethtool Command to Change Ethernet Adapter Settings

Note: The ethernet adapter settings cannot be changed for virtualized environments (such as a virtual machine) and on unsupported network drivers.

The ethtool -s command can be used to change the current settings by defining the values for speed, duplex, and autoneg in the following format:

sudo ethtool -s [device_name] autoneg [on/off] speed [10/100/1000] duplex [half/full]

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

sudo ethtool -s enp0s3 autoneg on speed 1000 duplex full

The ethtool [device_name] command is necessary to confirm that the changes have been applied.

Ethtool_opt Variable to Permanently Set Ethtool Command Settings

Changes made with Ethtool are by default reverted after a system is re-booted.

To apply custom settings each time a system boots edit the file for the device interface:

sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

Add the desired values as a line at the end of the file using the following syntax:

ETHTOOL_OPTS="speed [100|1000|10000] duplex [half|full] autoneg [on|off]"

For example:

ETHTOOL_OPTS="speed 1000 duplex full autoneg on"

Save the changes and exit the file.

Now the changes are applied after every reboot and are permanent unless the file is altered again.

Conclusion

By following this tutorial, you have successfully changed the settings on your Network Interface Card with ethtool commands. You have also gained a better understanding of how Auto-Negotiation and Duplex modes affect server performance.

How To Change Speed & Duplex of Ethernet Card in Linux with Ethtool Command

If you are using Linux, you can use the ethtool command to change the speed and duplex settings of your Ethernet card. This is useful if you are having problems with your network connection or if you want to optimize your network performance.

Step 1: Check the Current Settings

Before you make any changes, it is important to check the current settings of your Ethernet card. To do this, open a terminal window and type the following command:

ethtool eth0

This will display the current settings of your Ethernet card. Make a note of the current speed and duplex settings.

Step 2: Change the Settings

Once you have noted the current settings, you can change them using the following command:

ethtool -s eth0 speed [speed] duplex [duplex]

Replace [speed] and [duplex] with the desired speed and duplex settings. For example, if you want to set the speed to 100 Mbps and the duplex to full, you would use the following command:

ethtool -s eth0 speed 100 duplex full

Once you have entered the command, the settings will be changed immediately.

Step 3: Verify the Changes

To verify that the changes have been made, you can use the same command as in Step 1:

ethtool eth0

This will display the current settings of your Ethernet card. Make sure that the speed and duplex settings have been changed to the desired values.

Conclusion

Changing the speed and duplex settings of your Ethernet card in Linux is easy with the ethtool command. Just remember to check the current settings before making any changes, and to verify the changes afterwards.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?