Used to take Ethtool to determine whether the physical connection of the network is normal, and other functions have not been carefully read, but Ethtool is not simply to see if the network card is linked so simple, today to share the Ethtool tool simple usage.
First look at the command help:
usage:ethtool devnamedisplay standard information about device ethtool -s|--change DEVNAMEChange generic options[ speed 10|100|1000|2500|10000 ][ duplex half|full ][ port tp|aui|bnc|mii| fibre ][ autoneg on|off ][ advertise %%x ][ phyad %%d ][ xcvr internal|external ][ wol p|u|m|b|a|g|s|d... ][ sopass %%x:%%x:%% X:%%x:%%x:%%x ][ msglvl %%d ] ethtool -a|--show-pause DEVNAMEShow pause options Ethtool -a|--pause devnameset pause options[ autoneg on|off ][ rx on|off ][ tx on|off ] ethtool -c |--show-coalesce devnameshow coalesce options ethtool -c|--coalesce devnameset coalesce options[adaptive-rx on|off][adaptive-tx on|off][rx-usecs n][ Rx-frames n][rx-usecs-irq n][rx-frames-irq n][tx-usecs n][tx-frames n][tx-usecs-irq n][tx-frames-irq n][stats-block-usecs n][pkt-rate-low n][rx-usecs-low n][ rx-frames-low n][tx-usecs-low n][tx-frames-low n][pkt-rate-high n][rx-usecs-high n][ rx-frames-high n][tx-usecs-high n][tx-frames-high n][sample-interval n] ethtool -g|--show-ring DEVNAMEQuery RX/TX ring parameters ethtool -g|--set-ring devnameset rx/ tx ring parameters[ rx n ][ rx-mini n ][ rx-jumbo n ][ tx n ] ethtool -k|--show-offload devnameget protocol offload information ethtool -k|--offload devnameset protocol offload[ rx on|off ][ tx on|off ][ sg on|off ][ tso on|off ][ ufo on|off ][ gso on|off ] ethtool -i|--driver DEVNAMEShow driver information ethtool -d|--register-dump DEVNAMEDo a register dump[ raw on|off ][ file filename ] ethtool -e|--eeprom-dump devnamedo a eeprom dump[ raw on|off ][ offset n ][ length n ] ethtool -e|--change-eeprom devnamechange bytes in device eeprom[ magic n ][ offset n ][ value N ] ethtool -r|--negotiate devnamerestart n-way negotation ethtool -p|-- identify devnameshow visible port identification (e.g. blinking)              [ TIME-IN-SECONDS ] ethtool -t|--test DEVNAMEExecute adapter self test [ online | offline ] ethtool -s|-- statistics devnameshow adapter statistics Ethtool -h|--help devnameshow&nbSp;this help
Ethtool directly with the network card name, you can view all the network card information:
settings for eth0:supported ports: [ tp ]supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baset/full 1000baset/full supported pause frame use: nosupports auto-negotiation: yesadvertised link modes: 10baset/ half 10baset/full 100baseT/Half 100baseT/Full 1000baset/full advertised pause frame use: noadvertised auto-negotiation: yesspeed: 1000mb/sduplex: fullport: twisted pairphyad: 0transceiver: internalauto-negotiation: onmdi-x: off (Auto) supports wake-on: dwake-on: dcurrent message level: 0x00000007 (7) drv Probe linklink detected: yes
Can see eth0 this network card is automatically negotiated, full-duplex, the rate is 1000mb/s, the last line is to show whether your network card has a connection cable.
Ethtool-a eth0: Check the interrupt settings of the ETH0 network card:
Pause parameters for Eth0:Autonegotiate:onRX:offTX:off
Ethtol-i eth0: Check the drive name and info for the NIC:
Driver:e1000version:7.3.21-k8-napifirmware-version:bus-info:0000:02:01.0supports-statistics:yessupports-test: Yessupports-eeprom-access:yessupports-register-dump:yessupports-priv-flags:no
Ethtool-s|--statistics eth0: View network card statistics (including received and transferred packets):
Nic statistics: rx_packets: 45326 tx_ Packets: 17215 rx_bytes: 53883145 tx_bytes : 1510536 rx_broadcast: 0 tx_broadcast: 0 rx_multicast: 0 tx_multicast: 0 rx_errors: 0 tx_errors: 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_no_buffer_count: 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 tx_abort_late_coll: 0 tx_deferred_ok: 0 tx_single_coll_ok: 0 tx_multi_coll_ok: 0 tx_timeout_count: 0 tx_restart_queue: 0 rx_long_length_errors: 0 rx_short_length_errors: 0 rx_align_errors: 0 tx_tcp_seg_good: 24 tx_tcp_seg_failed: 0 rx_flow_control_xon: 0 rx_flow_control_xoff: 0 tx_flow_control_xon: 0 tx_flow_control_xoff: 0 rx_long_byte_count: 53883145 rx_csum_offload_good: 45078 rx_csum_offload_errors: 0 alloc_rx_buff_ Failed: 0 tx_smbus: 0 rx_smbus: 0 dropped_smbus: 0
Ethtool-s can change the speed and auto-negotiation parameters of the NIC:
# ethtool -s eth0 speed 100 autoneg off# root at vm3 in ~ [14:50:52]# ethtool eth0 settings for eth0:supported ports: [ TP ]Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baset/full supported pause frame use: nosupports auto-negotiation: Yesadvertised link modes: not reportedadvertised pause frame use: NoAdvertised auto-negotiation: NoSpeed: 100Mb/sDuplex: FullPort: Twisted pairphyad: 0transceiver: internalauto-negotiation: offmdi-x: off (Auto) supports wake-on: dwake-on: dcurrent message level: 0x00000007 (7) drv Probe linklink detected: yes
However, there is no special needs or not to change the network card rate, who want the faster the better.
The most commonly used is the following usage, I have previously worked on the production environment to adjust the network card of the RS and TX values.
Ethtool-k eth0, which shows the offload value of the TCP protocol for the NIC,-K can be adjusted for a parameter:
# ethtool -k eth0 features for eth0:rx-checksumming: offtx-checksumming: ontx-checksum-ipv4: off [fixed]tx-checksum-ip-generic: ontx-checksum-ipv6: off [fixed]tx-checksum-fcoe-crc: off [fixed]tx-checksum-sctp: off [fixed]scatter-gather: ontx-scatter-gather: ontx-scatter-gather-fraglist: off [fixed]tcp-segmentation-offload: Ontx-tcp-segmentation: ontx-tcp-ecn-segmentation: off [fixed]tx-tcp6-segmentation: off [fixed]udp-fragmentation-offload: off [fixed]generic-segmentation-offload: ongeneric-receive-offload: onlarge-receive-offload: off [fixed]rx-vlan-offload: ontx-vlan-offload: on [fixed]ntuple-filters: off [fixed]receive-hashing: off [ Fixed]highdma: off [fixed]rx-vlan-filter: on [fixed]vlan-challenged: off [fixed] Tx-lockless: off [fixed]netns-local: off [fixed]tx-gso-robust: off [fixed]tx-fcoe-segmentation: off [fixed] Tx-gre-segmentation: off [fixed]tx-ipip-segmentation: off [fixed]tx-sit-segmentation: off [fixed]tx-udp_tnl-segmentation: off [fixed]fcoe-mtu: off [fixed] Tx-nocache-copy: offloopback: off [fixed]rx-fcs: offrx-all: offtx-vlan-stag-hw-insert : off [fixed]rx-vlan-stag-hw-parse: off [fixed]rx-vlan-stag-filter: off [fixed] L2-fwd-offload: off [fixed]busy-poll: off [fixed]
Tcp-segmentation-offload:on refers to TCP shard work for packets that are larger than the system MTU setting, which is handled by the NIC instead of the CPU.
Generic-segmentation-offload:on similar to TSO, in addition to TCP packets, other protocol packages can also be partitioned with network cards.
Rx-checksumming:off refers to the checksum that disables received.
Tx-checksumming:on is the checksum that opens transfer.
The production environment servers are all 2个万 gigabit NIC bindings are used to accept the telco sig data, so my adjustments are as follows:
For I in 1 2 3 4;do for J in Rx Tx;do ethtool-k eth$i $j off;done;done for I in 1 2 3 4;do for J in Tso Gso;do Ethtool-k Eth$i $j On;done;done
Disable RX, TX for all network cards, and turn on TSO and GSO for all NICs to improve network performance.
Welcome to add!
This article is from "Tianya Horizon" blog, please be sure to keep this source http://shanker.blog.51cto.com/1189689/1766726
The network of performance tuning-Ethtool simple usage