ethtool

T he ethtool can be used to query and change settings such as speed, auto- negotiation and checksum offload on many network devices, especially Ethernet devices. How do I install and use ethtool under Ubuntu or Debian Linux based system running on my IBM server?


To control and see the settings of wired Ethernet devices you need to use the ethtool command. It can be used to:
  1. Get identification and diagnostic information
  2. Get extended device statistics
  3. Control speed, duplex, autonegotiation and flow control for Ethernet devices
  4. Control checksum offload and other hardware offload features
  5. Control DMA ring sizes and interrupt moderation
  6. Control receive queue selection for multiqueue devices
  7. Upgrade firmware in flash memory and much more

Install ethtool

Type the following apt-get command to install ethtool utility under Debian or Ubuntu Linux:
$ sudo apt-get update
$ sudo apt-get install ethtool

OR
# apt-get update
# apt-get install ethtool

Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  ethtool
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 99.5 kB of archives.
After this operation, 296 kB of additional disk space will be used.
Get:1 http://mirror.anl.gov/debian/ wheezy/main ethtool i386 1:3.4.2-1 [99.5 kB]
Fetched 99.5 kB in 2s (45.6 kB/s)  
Selecting previously unselected package ethtool.
(Reading database ... 23726 files and directories currently installed.)
Unpacking ethtool (from .../ethtool_1%3a3.4.2-1_i386.deb) ...
Processing triggers for man-db ...
Setting up ethtool (1:3.4.2-1) ...

Syntax

The syntax is:

ethtool deviceName
ethtool [options] deviceName
ethtool eth0

Examples

To see standard information about device eth0, enter:
# ethtool eth0
Sample outputs:

Settings for eth0:
	Supported ports: [ TP MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	Advertised pause frame use: Symmetric
	Advertised auto-negotiation: Yes
	Link partner advertised link modes:  10baseT/Half 10baseT/Full 
	                                     100baseT/Half 100baseT/Full 
	Link partner advertised pause frame use: Symmetric Receive-only
	Link partner advertised auto-negotiation: Yes
	Speed: 100Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 1
	Transceiver: internal
	Auto-negotiation: on
	Supports Wake-on: pumbg
	Wake-on: d
	Current message level: 0x00000001 (1)
			       drv
	Link detected: yes
FIND OUT DRIVER NAME ASSOCIATED DRIVER INFORMATION FOR ETH0

# ethtool -i eth0
Sample outputs:

driver: via-rhine
version: 1.5.0
firmware-version: 
bus-info: 0000:00:06.0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
FIND OUT STATISTICS FOR NIC AND DRIVER

# ethtool -S eth1
# ethtool --statistics eth0

Sample outputs:

NIC statistics:
     rx_packets: 108048475
     tx_packets: 125002612
     rx_bytes: 17446338197
     tx_bytes: 113281003056
     rx_broadcast: 83067
     tx_broadcast: 1329
     rx_multicast: 3
     tx_multicast: 9
     rx_errors: 0
     tx_errors: 0
     tx_dropped: 0
     multicast: 3
     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: 2367
     rx_long_length_errors: 0
     rx_short_length_errors: 0
     rx_align_errors: 0
     tx_tcp_seg_good: 0
     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: 17446338197
     rx_csum_offload_good: 107876452
     rx_csum_offload_errors: 2386
     rx_header_split: 0
     alloc_rx_buff_failed: 0
     tx_smbus: 0
     rx_smbus: 0
     dropped_smbus: 0
     rx_dma_failed: 0
     tx_dma_failed: 0
SETUP ETH0 NEGOTIATED SPEED

# ethtool -s eth0 speed 100 duplex full
# ethtool --change eth0 speed 10 duplex half
# ethtool eth0
# ethtool eth0 | egrep -i 'speed|duplex'

Sample outputs:

	Speed: 10Mb/s
	Duplex: Half

See ethtool command man page for more inforation:
$ man ethtool


03-21
<think>好的,我需要帮助用户查找关于ethtool的使用方法和相关文档。首先,我应该回顾用户提供的引用内容,看看里面有没有直接可用的信息。 用户给了三个引用,都是关于ethtool的。引用1提到了ethtool -K命令的用法,引用2和引用3则详细说明了如何安装ethtool以及一些具体的使用示例,比如查看网卡信息、驱动版本、错误统计等。根据这些内容,我可以整理出常见的使用场景和命令示例。 接下来,我需要确保回答结构清晰,分点说明使用方法,并生成相关问题。同时,要遵循用户要求的格式,比如行内数学表达式用$...$,但在这个问题中可能用不上数学公式,所以主要关注命令的格式和参数。 还需要注意引用标识要自然地加在相关段落后面,比如在解释某个命令时,如果引用了用户提供的例子,就加上对应的引用标记,比如[^3]。 然后,生成相关问题时要围绕ethtool的安装、常见命令、高级功能、故障排除等方向来提问,确保问题相关且有价值。 最后,检查所有LaTeX语法是否正确,不过这里可能用到的代码块是命令行示例,需要用代码块格式包裹,而不是LaTeX,所以需要注意这点。用户要求代码用反引号包裹,但示例中使用了三个反引号加语言标识,因此需要保持一致。 现在开始组织回答,分步骤说明ethtool的使用方法,并引用提供的资料中的例子。然后列出相关问题,确保每个问题都基于ethtool的不同方面。</think>### ethtool 使用方法与文档指引 #### 1. **安装与验证** - **安装方法**: 若系统中未安装`ethtool`,可通过包管理器安装: - Debian/Ubuntu:`sudo apt-get install ethtool` - RHEL/CentOS:`sudo yum install ethtool` 引用[2]中提到,若`which ethtool`无输出,需通过上述方式安装[^2]。 - **验证安装**: 输入`ethtool --version`,若显示版本号则安装成功。 #### 2. **基本功能与命令** - **查询网卡基本信息**: ```bash ethtool <interface> # 如 ethtool ens33 ``` 输出包含连接状态、速率、双工模式等信息[^3]。 - **识别物理网卡对应接口**: ```bash ethtool -p <interface> <N秒> # 如 ethtool -p ens33 10 ``` 物理网卡的LED灯会闪烁,便于定位接口。 - **查看驱动信息**: ```bash ethtool -i <interface> # 如 ethtool -i ens33 ``` 显示驱动名称、版本等,帮助排查兼容性问题。 #### 3. **高级功能** - **查看统计信息与错误**: ```bash ethtool -S <interface> # 如 ethtool -S ens33 ``` 输出接收/发送数据包的数量及错误统计,用于网络故障诊断。 - **调整网卡特性(需root权限)**: ```bash ethtool -K <interface> <feature_name> on/off # 如 ethtool -K ens33 gro on ``` 可启用或禁用特定功能(如GRO、LRO)以优化性能[^1]。 #### 4. **文档与帮助** - **查看完整手册**: ```bash man ethtool # 或 ethtool --help ``` 包含所有参数说明及用例。 - **在线文档**: - [官方手册页](https://man7.org/linux/man-pages/man8/ethtool.8.html) - Linux发行版官方文档(如Red Hat、Ubuntu Wiki)。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值