Use ethtool to get the full network card rate in Linux

Use ethtool to get the full network card rate in Linux

For some independent servers and VPS, the network card speed of the system cannot reach the nominal speed due to various reasons, or the network speed is limited due to personal needs, then ethtool is a suitable tool.

1. Full-speed network card rate <br />The following examples are all based on the full speed of 100Mbps.
1. Install ethtool
Under CentOS:

 yum -y install ethtool net-tools

Under Debian:

 apt-get install ethtool net-tools

2. Set the network card speed
a. Check the network card information

 ifconfig

View network port information

 ethtool eth0

b. Rate setting

 ethtool -s eth0 speed 100 duplex full autoneg off

The 100 represents 100Mbps

c. Set the startup to be added directly to the network card information in /etc/sysconfig/network-scripts/ifcfg-eth0

 ETHTOOL_OPTS="speed 100 duplex full autoneg off"

/etc/sysconfig/network-scripts/ifcfg-eth0 is slightly different on different systems

d. Debian setup method (ignore steps b and c)
Add in the /etc/network/interfaces file

 link-speed 100 link-duplex full ethernet-autoneg off

2. Common commands of ethtool
ethtool eth0 //Query the basic settings of the ethx network port, where x is the number of the corresponding network card, such as eth0, eth1, etc.
ethtool -h //Display ethtool command help (help)
ethtool -i eth0 //Query the relevant information of eth0 network port
ethtool -d eth0 //Query the registration information of eth0 network port
ethtool -r eth0 //Reset eth0 network port to adaptive mode
ethtool -S eth0 //Query the statistics of packets sent and received on the eth0 network port
ethtool -s eth0 [speed 10|100|1000] [duplex half|full] [autoneg on|off] //Set the network port rate to 10/100/1000M, set the network port half/full duplex, and set whether the network port is auto-negotiation

<<:  DediPath: $18/month/4GB memory/250GB space/10TB traffic/5 IP/KVM/Los Angeles

>>:  DeinServerHost: €8.95/month/4GB RAM/100GB SSD space/unlimited traffic/DDOS/Windows/Germany

Recommend

Veesp: $25.2/year/1GB memory/50GB space/unlimited traffic/200Mbps/KVM/Russia

Veesp, a Russian hosting company, was introduced ...

Node Wing: $39/year/1GB memory/60GB space/unlimited traffic/KVM/France

Node Wing, a foreign hosting company, was establi...

RootNerds: €1.99/month/1GB RAM/50GB SSD space/200GB bandwidth/OpenVZ/Germany

RootNerds, a German hosting company founded in 20...

Gestion DBI: Black Friday vps 60% off

Gestion DBI is a very well-reviewed merchant with...

VPCKR 4G memory 200Mbps unlimited traffic Korea sk KVM VPS review

Details : VPCKR: $149/month/2G memory/20GB SSD sp...

Tranzmedia: $7/month/2GB RAM/10GB SSD space/unlimited traffic/KVM/Italy

Tranzmedia, an Indian hosting provider, was estab...

domain.com Register a domain name for $3.99

Pictures speak louder than words! For details, pl...