Use the Ethtool command to solve the Linux NIC packet loss __linux

Source: Internet
Author: User
Production of a Linux device concurrency is relatively large, droped packet more, especially in the running game packets, there is a serious loss of packet phenomenon, suspected network card performance, in the replacement of equipment before the solution through the software method, through some data on the internet to show that this phenomenon, Also may be the network card buffer size is too small reason, so try to change the buffer resolution, the following equipment run 64 days, lost more than more than 2 billion packets.

The Ethtool command is used to obtain configuration information for Ethernet cards or to modify these configurations

-A view the status of the Receive Module RX, send module TX, and Autonegotiate modules in the network card: start on or deactivate off.
-A modifies the status of the Receive Module RX, send module TX, and Autonegotiate modules in the network card: start on or deactivate off.

-C Display the coalesce information of the specified Ethernet card.
-C Change the coalesce setting of the specified Ethernet card.

-G Display The Rx/tx ring parameter information of the specified Ethernet card.
-G Change the rx/tx ring setting of the specified Ethernet card.

-I displays information driven by the NIC, such as the driver name, version, and so on.
-D Displays the register dump information, which is not supported by some network adapter drivers.

-e Displays the EEPROM dump information, which is not supported by some NIC drivers.
-e modifies the NIC Eeprom byte.

-K Displays the status of the NIC offload parameter: On or off, including rx-checksumming, tx-checksumming, and so on.
-K modifies the status of the NIC offload parameter.

-P is used to distinguish the physical location of different ethx corresponding to the network card, the usual method is to make the LED on the port of the network card flashing continuously; n indicates the duration of the network card flicker, in seconds.
-R Restarts Auto-negotiation if the state of the Auto-negotiation module is on.

-S displays the statistical parameters of the Nic-and driver-specific, such as the number of bytes received/sent by the NIC, the number of broadcast packets received/sent, and so on.

-T let the NIC perform self detection, there are two modes: offline or online.

-S to modify the partial configuration of the network card, including network card speed, simplex/Full-duplex mode, MAC address and so on.


View the current NIC's buffer size ethtool-g eth0

Ring parameters for eth0:
Pre-set maximums:
Rx:4096rx mini:0
RX jumbo:0
tx:4096
Current hardware settings:
rx:256
RX mini:0
RX jumbo:0
tx:256

Because my Rx bag will have a droped situation.

We use ETHTOOL-G eth0 Rx 2048

The same is true for eth1 ethtool-g eth1 Rx 2048

And look at the modified ethtool-g eth0.

Ring parameters for eth0:
Pre-set maximums:
rx:4096
RX mini:0
RX jumbo:0
tx:4096
Current hardware settings:
rx:2048
RX mini:0
RX jumbo:0
tx:2048

Command Description:

Ethtool is the command used to query and set the network card parameters.


Usage Summary:
Ethtool ethx//Query ETHX network Basic settings, where x is the corresponding number of network cards, such as eth0, eth1, etc.
ETHTOOL–H//Display command Help for Ethtool

Ethtool–i ethx//Query ETHX network port information
Ethtool–d ethx//Inquiry ETHX Network registration information

Ethtool–r ethx//Reset ETHX network port to Adaptive mode
Ethtool–s ethx//query ETHX network receipt and contract statistics

Ethtool–s ethx [Speed 10|100|1000] [duplex half|full] [Autoneg On|off]//Set the network port rate 10/100/1000m, set the network mouth half/Full-duplex, set the network port whether from negotiation


Use examples:
1) [Root@linux/]# Ethtool eth1
Settings for eth1:
Supported ports: [TP]
Supported Link Modes:10baset/half 10baset/full
100baset/half 100baset/full
1000baset/full
Supports Auto-negotiation:yes
Advertised Link Modes:10baset/half 10baset/full
100baset/half 100baset/full
1000baset/full
Advertised Auto-negotiation:yes
speed:1000mb/s
Duplex:full
Port:twisted Pair
phyad:0
Transceiver:internal
Auto-negotiation:on
Supports WAKE-ON:UMBG
Wake-on:d
Link Detected:yes
2) [Root@linux/]# ethtool-i eth1
driver:e1000
Version:5.0.43-k1
firmware-version:n/a
bus-info:06:08.1
3) [Root@linux/]# ethtool-s eth1
NIC Statistics:
rx_packets:58068300
tx_packets:87124083
rx_bytes:1589713008
tx_bytes:2165825901
rx_errors:0
tx_errors:0
rx_dropped:0
tx_dropped:0
multicast:0
collisions:0
rx_length_errors:0
rx_over_errors:0
rx_crc_errors:0
rx_frame_errors:0
rx_fifo_errors:0
rx_missed_errors:0
tx_aborted_errors:0
tx_carrier_errors:0
tx_fifo_errors:0
tx_heartbeat_errors:0
tx_window_errors:0

4) [Root@linux/]# ethtool-s eth1 Autoneg off speed-duplex full


Related reference:
1) [Root@linux/]# which Ethtool//query Ethtool stored path
/sbin/ethtool
2) [Root@linux/]# rpm-qf/sbin/ethtool//query Ethtool version information
Ethtool-1.6-5
3 The method of setting the Ethtool to permanent storage in the network device
Workaround One:
The Ethtool setting can be saved by/etc/sysconfig/network-scripts/ifcfg-ethx file to activate the option the next time the device starts.

Example: ethtool-s eth0 speed Duplex full Autoneg off

This directive sets the eth0 device to full duplex adaptive speed of 100Mbs. To set these parameters eth0 startup, modify the file/etc/sysconfig/network-scripts/ifcfg-eth0,
Add the following line:
ethtool_opts= "Speed duplex full Autoneg off"
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.