00. 目录

文章目录

  • 00. 目录
  • 01. 命令概述
  • 02. 命令格式
  • 03. 常用选项
  • 04. 参考示例
  • 05. 总结
  • 06. 附录

01. 命令概述

ethtool命令用于查询ethX网口基本设置、及设置网卡的参数。

命令比较复杂,功能特别多。

02. 命令格式

ethtool [ -a | -c | -g | -i | -d | -k | -r | -S |] ethX
ethtool [-A] ethX [autoneg on|off] [rx on|off] [tx on|off]
ethtool [-C] ethX [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-lowN] [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] ethX [rx N] [rx-mini N] [rx-jumbo N] [tx N]
ethtool [-e] ethX [raw on|off] [offset N] [length N]
ethtool [-E] ethX [magic N] [offset N] [value N]
ethtool [-K] ethX [rx on|off] [tx on|off] [sg on|off] [tso on|off]
ethtool [-p] ethX [N]
ethtool [-t] ethX [offline|online]
ethtool [-s] ethX [speed 10|100|1000] [duplex half|full] [autoneg on|off] [port tp|aui|bnc|mii] [phyad N] [xcvr internal|external]
[wol p|u|m|b|a|g|s|d...] [sopass xx:yy:zz:aa:bb:cc] [msglvl N]

03. 常用选项

-a 查看网卡中 接收模块RX、发送模块TX和Autonegotiate模块的状态:启动on 或 停用off。
-A 修改网卡中 接收模块RX、发送模块TX和Autonegotiate模块的状态:启动on 或 停用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 显示网卡驱动的信息,如驱动的名称、版本等。
-d 显示register dump信息, 部分网卡驱动不支持该选项。
-e 显示EEPROM dump信息,部分网卡驱动不支持该选项。
-E 修改网卡EEPROM byte。
-k 显示网卡Offload参数的状态:on 或 off,包括rx-checksumming、tx-checksumming等。
-K 修改网卡Offload参数的状态。
-p 用于区别不同ethX对应网卡的物理位置,常用的方法是使网卡port上的led不断的闪;N指示了网卡闪的持续时间,以秒为单位。
-r 如果auto-negotiation模块的状态为on,则restarts auto-negotiation。
-S 显示NIC- and driver-specific 的统计参数,如网卡接收/发送的字节数、接收/发送的广播包个数等。
-t 让网卡执行自我检测,有两种模式:offline or online。
-s 修改网卡的部分配置,包括网卡速度、单工/全双工模式、mac地址等。

04. 参考示例

4.1 查询网卡基本设置

[deng@localhost ~]$ ethtool ens33
Settings for ens33:Supported ports: [ TP ]Supported link modes:   10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: NoSupports auto-negotiation: YesSupported FEC modes: Not reportedAdvertised link modes:  10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: NoAdvertised auto-negotiation: YesAdvertised FEC modes: Not reportedSpeed: 1000Mb/sDuplex: FullPort: Twisted PairPHYAD: 0Transceiver: internalAuto-negotiation: onMDI-X: off (auto)
Cannot get wake-on-lan settings: Operation not permittedCurrent message level: 0x00000007 (7)drv probe linkLink detected: yes
[deng@localhost ~]$

4.2 查询网卡驱动相关信息

[deng@localhost ~]$ ethtool -i ens33
driver: e1000
version: 7.3.21-k8-NAPI
firmware-version:
expansion-rom-version:
bus-info: 0000:02:01.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no
[deng@localhost ~]$

4.3 查询网卡收发包统计

[deng@localhost ~]$ ethtool -S ens33
NIC statistics:rx_packets: 15796742tx_packets: 31586rx_bytes: 4802989050tx_bytes: 5649128

4.4 查询网卡注册信息

[root@localhost ~]# ethtool -d ens33
MAC Registers
-------------
0x00000: CTRL (Device control register)  0x00C00249Endian mode (buffers):             littleLink reset:                        resetSet link up:                       1Invert Loss-Of-Signal:             no

4.5 设置网卡自适应模式

[root@localhost ~]# ethtool -r ens33
[root@localhost ~]#

4.6 设置网卡速率等信息

[root@localhost ~]# ethtool -s ens33 autoneg off speed 100 duplex full

4.7 停止网卡的发送模块TX

[root@localhost ~]# ethtool -A tx off ens33

4.8 设置网卡速率为100M

[root@localhost ~]# ethtool -s ens33 speed 100

4.9 使网卡灯闪烁10次

[root@localhost ~]# ethtool -p ens33 10
[root@localhost ~]#

操作完毕后,看哪块网卡的led灯在闪,eth0就对应着哪块网卡。

4.10 显示网卡Offload参数的状态

[root@localhost ~]# ethtool -k ens33
Features for ens33:
rx-checksumming: off
tx-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]

4.11 关闭网卡对收到的数据包的校验功能

[root@localhost ~]# ethtool -K ens33 rx off

4.12 显示EEPROM dump信息

[root@localhost ~]# ethtool -e ens33
Offset          Values
------          ------
0x0000:         00 50 56 26 d8 88 20 04 ff ff ff ff ff ff ff ff
0x0010:         00 00 00 00 0b 46 50 07 ad 15 0f 10 86 80 e8 01
0x0020:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0x0030:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0x0040:         de df 61 78 0c 28 00 00 c8 00 ff ff ff ff ff ff
0x0050:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff 02 06
0x0060:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0x0070:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 3a
0x0080:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0x0090:         ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[root@localhost ~]#

05. 总结

06. 附录

参考:【Linux】一步一步学Linux系列教程汇总

【Linux】一步一步学Linux——ethtool命令(155)相关推荐

  1. 学linux作用,linux有必要学吗?学linux有什么作用,学linux能干什么

    Linux是一种自由和开放源码的类UNIX操作系统.Linux有必要学吗?学Linux有什么作用,学Linux能干什么?Linux最大的作用就是提高效率.当你习惯在Linux命令行下工作,再回到win ...

  2. LINUX学习之路(学LINUX必看)

    很多同学接触Linux不多,对Linux平台的开发更是一无所知.而现在的趋势越来越表明,作为一 个优秀的软件开发人员,或计算机IT行业从业人员,掌握Linux是一种很重要的谋生资源与手段.下来我将会结 ...

  3. linux学习需要什么基础,学linux需要什么基础?

    近几年来,随着计算机网络的发展,越来越多的人学习 linux.对于想要从事运维工作或者从事智能开发方面的同学来说,学习 linux 是必要的.linux 的学习并不简单,那么这篇文章 w3cschoo ...

  4. 分享--linux 学习之路(学linux必看)

    很多同学接触Linux不多,对Linux平台的开发更是一无所知. 而现在的趋势越来越表明,作为一个优秀的软件开发人员,或计算机IT行业从业人员, 掌握Linux是一种很重要的谋生资源与手段. 下来我将 ...

  5. 英语不好学linux运维难吗,学Linux系统难吗?学好Linux运维需要多久

    随着近年来经济的快速发展,企业对Linux人才的需求也越来越高.许多人认为,Linux是一个非常简单的行业,然而,Linux行业是一个综合了云计算.Linux运维.Linux开发.Linux编程等多方 ...

  6. 不会linux的php难找工作,学linux系统难吗

    这是 Linux初学者经常会问的问题,其实Linux和Windows一样都属于操作系统,对于大部分人来说,对Windows操作系统十分熟悉,而对Linux操作系统没有使用过,所以觉得很难,其实,只要熟 ...

  7. linux lamp实验报告,新手学Linux--构建lamp

    本人前不久开始学习Linux,俗话说得好,好记性不如烂笔头,于是决定将平日所学所做实验,记录下来,以备回顾.由于本人是个初学者,所以借鉴了很多网上的资料,但在此处写出来的都是经过本人思考和多次实验的记 ...

  8. Linux 命令(194)—— ethtool 命令

    文章目录 1.命令简介 2.命令格式 3.选项说明 4.常用示例 5.拓展知识 参考文献 1.命令简介 ethtool(ethernet tool)查询或控制网络驱动程序和硬件设置. 利用 ethto ...

  9. Linux其实没那么难学

    互联网技术总是更新迭代的,因为2020年的一场疫情,影响着中国乃至整个世界,就在这一年,网络直播,远程办公,在线教育等等的互联网产物进入了众多人的世界,当然,这其中离不开程序员的功劳. 李开复曾经说过 ...

最新文章

  1. mysql主从(GTID复制模式)
  2. boost::spirit模块实现使用不同的输出语法格式化单个容器类型的测试程序
  3. 反思Code Review的注意点与目的
  4. 读取 wps_软件前世今生篇之WPS(求伯君1988年先于OFFICE研发出WPS)
  5. 微软P2V工具之Disk2VHD
  6. 数组(数组名)与指针辨异
  7. 十法则打造安全无线局域网
  8. 初中计算机第一课怎么讲,初中信息技术第一课 图像及其简单处理教学设计
  9. C#控制台应用程序执行结果一闪而过的解决方法
  10. Android:在酷安发布应用流程记录
  11. 记一次优化天猫商城系统高并发的经验
  12. 【笔记】华为P40手机谷歌play安装与测试笔记
  13. 2018腾讯社交广告算法大赛总结/0.772229/Rank11-复习代码
  14. 投资学U14 债券的估值和收益率 习题解读
  15. 根据3倍图生成2倍图和1倍图
  16. 企业支付宝 异名网银u盾快速充值功能开通方式(支付宝企业商户资金充值方法)
  17. cap7 集成学习和随机森林
  18. ubuntu 清空回收站
  19. FastStone Capture——集截屏、滚动截图、录屏、图片编辑为一体轻量级截图软件
  20. 单元测试:通过读取csv/xml数据并且结合使用allure展示测试报告,验证开发中的add()和reduct()操作(在@allure.story分别实现相加减)

热门文章

  1. Lucene:QueryParser
  2. linux 查看opengl版本,linux下查看OpenGL版本
  3. pymongo查询列表元素_散列表:如何实现word编辑器的拼写检查?
  4. cocos2dx java 调用lua_Cocos2d-x Lua实现从Android回调到Lua的方法
  5. 阿里巴巴集团2014秋季校园招聘笔试题
  6. 【AtCoder】AGC034
  7. ?类型 ,?类型(值)
  8. spring-boot-2.0.3之quartz集成,不是你想的那样哦!
  9. 通过JAVA对HDFS进行操作管理插件
  10. Python 前端的第三方库