轉載:http://crazyming.blog.51cto.com/1048571/738022
debian 下安裝: sudo apt-get install ethtool
或者下載源碼編譯:http://pan.baidu.com/s/1ntJPfct
這個是官網下載地址:http://ethtool.sourcearchive.com/
Linux/Unix命令之Ethtool
描述:
Ethtool是用於查詢及設置網卡參數的命令。
概要:
ethtool ethX //查詢ethX網口基本設置
ethtool –h //顯示ethtool的命令幫助(help)
ethtool –i ethX //查詢ethX網口的相關信息
ethtool –d ethX //查詢ethX網口注冊性信息
ethtool –r ethX //重置ethX網口到自適應模式
ethtool –S ethX //查詢ethX網口收發包統計
ethtool –s ethX [speed 10|100|1000]\ //設置網口速率10/100/1000M
[duplex half|full]\ //設置網口半/全雙工
[autoneg on|off]\ //設置網口是否自協商
[port tp|aui|bnc|mii]\ //設置網口類型
[phyad N]\
[xcvr internal|exteral]\
[wol p|u|m|b|a|g|s|d...]\
[sopass xx:yy:zz:aa:bb:cc]\
[msglvl N]
舉例:
1)[root@linux /]# ethtool eth1
2)[root@linux /]# ethtool -i eth1
3)[root@linux /]# ethtool -S eth1
NIC statistics:
4)[root@linux /]# ethtool -s eth1 autoneg off speed 100 duplex full
相關:
1)[root@linux /]# which ethtool
/sbin/ethtool
2)[root@linux /]# rpm -qf /sbin/ethtool
ethtool-1.6-5
3)怎樣使ethtool設置永久保存在網絡設備中?
解決方法一:
ethtool設置可通過/etc/sysconfig/network-scripts/ifcfg-ethX文件保存,從而在設備下次啟動時激活選項。
例如:ethtool -s eth0 speed 100 duplex full autoneg off
此指令將eth0設備設置為全雙工自適應,速度為100Mbs。若要eth0啟動時設置這些參數, 修改文件/etc/sysconfig/network-scripts/ifcfg-eth0 ,添加如下一行:
ETHTOOL_OPTS="speed 100 duplex full autoneg off"
解決方法二:
將ethtool設置寫入/etc/rc.d/rc.local之中。
二
解決方法:
對Intel千兆網卡禁用自適應時必須指定鏈路速度和全雙工模式。當使用ethtool來禁用使用e1000網卡驅動模塊的網卡自適應特性時,必須同時指定鏈路速度和全雙工工作模式。例如: ethtool -s eth0 autoneg off
會邊比自適應,但是只是臨時禁用,如果在命令中沒有指定鏈路速度和全雙工工作模式,驅動會自動重新打開自適應。
為了使用ethtool工具來禁用e1000網卡驅動模塊的網卡自適應特性,使用以下步驟
1. 進入終端模式。 2. 以root身份執行 ethtool -s ethx autoneg off speed 1000 duplex full
這里ethX是網卡的名字(例如eth0或者eth1等等),這個命令將關閉該網卡的自適應特性,並且強制設置網卡速度為1Gb,全雙公模式。
另外ethtool比mii-tool要高級,mii-tool只支持 Port: MII的網卡.
OPTIONS
- -h
- shows a short help message.
- -a
- queries the specified ethernet device for pause parameter information.
- -A
- change the pause parameters of the specified ethernet device.
- autoneg on|off
- Specify if pause autonegotiation is enabled.
- rx on|off
- Specify if RX pause is enabled.
- tx on|off
- Specify if TX pause is enabled.
- -c
- queries the specified ethernet device for coalescing information.
- -C
- change the coalescing settings of the specified ethernet device.
- -g
- queries the specified ethernet device for rx/tx ring parameter information.
- -G
- change the rx/tx ring parameters of the specified ethernet device.
- rx N
- Change number of ring entries for the Rx ring.
- rx-mini N
- Change number of ring entries for the Rx Mini ring.
- rx-jumbo N
- Change number of ring entries for the Rx Jumbo ring.
- tx N
- Change number of ring entries for the Tx ring.
- -i
- queries the specified ethernet device for associated driver information.
- -d
- retrieves and prints a register dump for the specified ethernet device.
- -e
- retrieves and prints an EEPROM dump for the specified ethernet device.
- -k
- queries the specified ethernet device for checksumming information.
- -K
- change the checksumming parameters of the specified ethernet device.
- rx on|off
- Specify if RX checksumming is enabled.
- tx on|off
- Specify if TX checksumming is enabled.
- sg on|off
- Specify if scatter-gather is enabled.
- -p
- initiates adapter-specific action intended to enable an operator to easily identify the adapter by sight. typically this involves blinking one or more LEDs on the specific ethernet port.
- N
- Length of time to perform phys-id, in seconds.
- -r
- restarts auto-negotiation on the specified ethernet device, if auto-negotiation is enabled.
- -S
- queries the specified ethernet device for NIC- and driver-specific statistics.
- -t
- executes adapter selftest on the specified ethernet device. Possible test modes are:
- offline|online
- defines test type: offline (default) means to perform full set of tests possibly causing normal operation interruption during the tests, online means to perform limited set of tests do not interrupting normal adapter operation.
- -s
- option allows changing some or all settings of the specified ethernet device. All following options only apply if -s was specified.
- speed 10|100|1000
- Set speed in Mb/s. ethtool with single argument will show you the supported device speeds.
- duplex half|full
- Set full or half duplex mode.
- port tp|aui|bnc|mii
- Select device port.
- autoneg on|off
- Specify if autonegotiation is enabled. In the usual case it is, but might cause some problems with some network devices, so you can turn it off.
- phyad N
- PHY address.
- xcvr internal|external
- Select transceiver type. Currently only internal and external can be specified, in the future further types might be added.
- wol p|u|m|b|a|g|s|d...
-
Set Wake-on-LAN options. Not all devices support this. The argument to this option is a string of characters specifying which options to enable.
-
- p
- Wake on phy activity
- u
- Wake on unicast messages
- m
- Wake on multicast messages
- b
- Wake on broadcast messages
- a
- Wake on ARP
- g
- Wake on MagicPacket(tm)
- s
- Enable SecureOn(tm) password for MagicPacket(tm)
- d
- Disable (wake on nothing). This option clears all previous options.
-
- sopass xx:yy:zz:aa:bb:cc
- Set the SecureOn(tm) password. The argument to this option must be 6 bytes in ethernet MAC hex format (xx:yy:zz:aa:bb:cc).
- msglvl N
- Set the driver message level. Meanings differ per driver