一、命令描述:
ethtool 是用于查询及设置网卡参数的命令。
ethtool eth0 //查询eth网口基本设置
ethtool –h //显示ethtool的命令帮助(help)
ethtool –i eth0 //查询eth0网口的相关信息
ethtool –d eth0 //查询eth0网口注册性信息
ethtool –r eth0 //重置eth0网口到自适应模式
ethtool –S eth0 //查询eth0网口收发包统计
ethtool –s eth0 [speed 10|100|1000] [duplex half|full] [autoneg on|off] //设置网口速率10/100/1000M、网口半/全双工、网口是否自协商
ethtool -E eth0 magic 0x10798086 offset 0x10 value 0x1A //修改网卡EEPROM内容(0x1079 网卡device id , 0x8086网卡verdor id )
ethtool -e eth0 //dump网卡EEPROM内容
二、使用举例:
1) ethtool ens33
2) ethtool -i ens33
3) ethtool -S ens33
4)ethtool -a ens33 查找流控开关
5)ethtool -t ens33
[root]# ethtool -t ens33
The test result is PASS
The test extra info:
Register test (offline) 0
Eeprom test (offline) 0
Interrupt test (offline) 0
Loopback test (offline) 0
Link test (on/offline) 0
5)ethtool -h
关于更大用法,可以查询
ethtool -h
ethtool version 5.4
Usage:
ethtool DEVNAME Display standard information about device
ethtool -s|--change DEVNAME Change generic options
[ speed %d ]
[ duplex half|full ]
[ port tp|aui|bnc|mii|fibre ]
[ mdix auto|on|off ]
[ autoneg on|off ]
[ advertise %x ]
[ phyad %d ]
[ xcvr internal|external ]
[ wol p|u|m|b|a|g|s|f|d... ]
[ sopass %x:%x:%x:%x:%x:%x ]
[ msglvl %d | msglvl type on|off ... ]
ethtool -a|--show-pause DEVNAME Show pause options
ethtool -A|--pause DEVNAME Set pause options
[ autoneg on|off ]
[ rx on|off ]
[ tx on|off ]
ethtool -c|--show-coalesce DEVNAME Show coalesce options
ethtool -C|--coalesce DEVNAME Set 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 DEVNAME Query RX/TX ring parameters
ethtool -G|--set-ring DEVNAME Set RX/TX ring parameters
[ rx N ]
[ rx-mini N ]
[ rx-jumbo N ]
[ tx N ]
ethtool -k|--show-features|--show-offload DEVNAME Get state of protocol offload and other features
ethtool -K|--features|--offload DEVNAME Set protocol offload and other features
FEATURE on|off ...
ethtool -i|--driver DEVNAME Show driver information
ethtool -d|--register-dump DEVNAME Do a register dump
[ raw on|off ]
[ file FILENAME ]
ethtool -e|--eeprom-dump DEVNAME Do a EEPROM dump
[ raw on|off ]
[ offset N ]
[ length N ]
ethtool -E|--change-eeprom DEVNAME Change bytes in device EEPROM
[ magic N ]
[ offset N ]
[ length N ]
[ value N ]