How well your servers communicate depends on how your Ethernet card is configured. Here at Arzhost, we discuss the Ethtool command change speed duplex ethernet card Linux to modify the settings.
To maintain network connectivity with the least amount of effort, it is vital to comprehend how Auto-Negotiation, Speed, and Duplex settings affect the transport of data.
This tutorial will demonstrate how to use the ethtool commands in Linux (CentOS) to modify the Speed, Duplex, and Auto-Negotiation settings.
- Command window or terminal
- A user account having sudo or root permissions
- Installed was the Ethtool configuration tool.
Auto-Negotiation, Full Duplex, and Half Duplex
In half-duplex mode, a device can alternately send and receive packets. This setting prevents a gadget from carrying out both tasks at once.
A device can send and receive packets simultaneously when its mode is set to full-duplex.
An auto-negotiation mechanism allows a device to select the best transmission mode based on the characteristics of its counterparts. Auto-Negotiation should always be on because it enables devices to select the fastest method for data transfer.
An Explanation of a Duplex Mismatch
The process does not function when a device with enabled auto-negotiation connects to a device that is not using this signaling mechanism. Although the duplex mode cannot be accurately detected, the end of the connection with an active auto-negotiation can nevertheless determine the speed of the other end.
Typically, the connection’s auto-negotiating end operates at half-duplex while the other end may operate at full-duplex. This circumstance is known as a duplex mismatch.
A duplex mismatch does not entirely halt communication. Small data volumes and single packets do not immediately result in problems. However, the speed drastically decreases when a lot of data is transferred from either end.
The connection is functional, but the performance is compromised because of the unequal data transfer rate, which could result in packet loss.
How to Set Up a NIC Using the Ethtool Command?
You may retrieve data and modify your NIC settings using the Network Interface Card configuration command ethtool. These options contain several different settings, such as Speed, Duplex, and Auto-Negotiation.
You must be aware of the name of your network interface card in order to continue.
Use the command shown below in the command terminal to determine the name of your network interface card:
The name of the device interface card is provided in the output. Read How to Install and Use ifconfig for more information on this command.
The device in the aforementioned example is identified as enp0s3.
Once you have identified the device’s name, use the command Ethtool device name to see its current Speed, Auto-Negotiation, and Duplex mode settings.
In the instance we’re using, the command is:
The output indicates that Auto-Negotiation is activated, the Duplex is set to Full, and the speed is currently 1000 Mb/s.
Ethtool Command to Change Ethernet Adapter Settings
You can modify the settings by specifying the speed, duplex, and autoneg values with the Ethtool -s command in the following format:
[Device name]: sudo Ethtool -s autoneg [on/off] speed [10/100/1000] duplex [half/full]
For instance, the following would be the command to set the speed to 1000Mb/s with the duplex mode set to full and the auto-negotiation set to on:
enp0s3 autoneg on speed 1000 duplex full with sudo Ethtool
The Ethtool [device name] command is necessary to confirm that the changes have been applied.
ethtool opt Variable to Set Ethtool Command Settings Permanently
Ethtool modifications are by default undone when a system is restarted.
Edit the file for the device interface to apply custom settings each time the system boots:
The command line iffy-enp0s3 sudo vi /etc/sysconfig/network-scripts
Use the following syntax to add the desired values as a line at the end of the file:
ETHTOOL OPTS= "speed [100|1000|10000] Duplex autoneg [on off] (half/full)"
Speed 1000 Duplex Full Automatic On ETHTOOL OPTS
Save your changes, then close the document.
Currently, the modifications take effect after each reboot and are irreversible unless the file is changed again.
You have successfully used the Ethtool commands in this tutorial to modify the settings on your Network Interface Card. Additionally, you now know more about how the Auto-Negotiation and Duplex modes impact server performance.