【计算机网络】10、ethtool

文章目录
- 一、ethtool
- 1.1 常见操作
- 1.1.1 展示设备属性
- 1.1.2 改变网卡属性
- 1.1.2.1 Auto-negotiation
- 1.1.2.2 Speed
- 1.1.3 展示网卡驱动设置
- 1.1.4 只展示 Auto-negotiation, RX and TX
- 1.1.5 展示统计
- 1.1.7 排除网络故障
- 1.1.8 通过网口的 LED 区分网卡
- 1.1.9 持久化配置(无需 reboot)
一、ethtool
ethtool is used to query and control network device driver and hardware settings, particularly for wired Ethernet devices.
devname is the name of the network device on which ethtool should operate.
man 文档
参考
1.1 常见操作
1.1.1 展示设备属性
# root@ubuntu:~# ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536# ethtool eno1
Settings for eno1:Supported ports: [ TP MII ]Supported link modes: 10baseT/Half 10baseT/Full100baseT/Half 100baseT/Full1000baseT/FullSupported pause frame use: Symmetric Receive-onlySupports auto-negotiation: YesSupported FEC modes: Not reportedAdvertised link modes: 10baseT/Half 10baseT/Full100baseT/Half 100baseT/Full1000baseT/FullAdvertised pause frame use: Symmetric Receive-onlyAdvertised auto-negotiation: YesAdvertised FEC modes: Not reportedSpeed: Unknown!Duplex: Unknown! (255)Auto-negotiation: onmaster-slave cfg: preferred slavemaster-slave status: unknownPort: Twisted PairPHYAD: 0Transceiver: externalMDI-X: UnknownSupports Wake-on: pumbgWake-on: dLink detected: no# ethtool docker0
Settings for docker0:Supported ports: [ ]Supported link modes: Not reportedSupported pause frame use: NoSupports auto-negotiation: NoSupported FEC modes: Not reportedAdvertised link modes: Not reportedAdvertised pause frame use: NoAdvertised auto-negotiation: NoAdvertised FEC modes: Not reportedSpeed: 10000Mb/sDuplex: Unknown! (255)Auto-negotiation: offPort: OtherPHYAD: 0Transceiver: internalLink detected: yes# ethtool lo
Settings for lo:Link detected: yes
其中全双工、半双工、自动协商的区别如下:
- Full duplex : Enables sending and receiving of packets at the same time. This mode is used when the ethernet device is connected to a switch(交换机).
- Half duplex : Enables either sending or receiving of packets at a single point of time. This mode is used when the ethernet device is connected to a hub(集线器).
- Auto-negotiation : If enabled, the ethernet device itself decides whether to use either full duplex or half duplex based on the network the ethernet device attached to.
1.1.2 改变网卡属性
1.1.2.1 Auto-negotiation
上文展示的 Auto-negotiation 为 true,可通过 -s autoneg 关闭它。
# ifdown eth0eth0 device: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)eth0 configuration: eth-bus-pci-0000:0b:00.0# ethtool -s eth0 autoneg off # -s 指定网卡名称, 设置 autoneg = off# ethtool eno1
Settings for eno1:Supported ports: [ TP MII ]Supported link modes: 10baseT/Half 10baseT/Full100baseT/Half 100baseT/Full1000baseT/Full。。。Auto-negotiation: off # 此处信息已变为 offLink detected: down # 此处信息已变为 down# ifup eno1
1.1.2.2 Speed
改变网卡速度,注意不要设置超过网卡的 limited capacity
# ethtool eth0 | grep SpeedSpeed: 1000Mb/s# ethtool -s eth0 speed 100 autoneg off# ethtool eth0 | grep SpeedSpeed: Unknown! (65535) # 注意:如果网卡在 online 时,被改了 speed 则会自动变为 offline,此时需要手动 ifup# ifup eth0eth0 device: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)eth0 configuration: eth-bus-pci-0000:0b:00.0Checking for network time protocol daemon (NTPD): running# ethtool eth0 | grep SpeedSpeed: 100Mb/s# 可看到设置后从 1000Mb/s 变为 100Mb/s
可通过 ifconfig 设置 MTU
1.1.3 展示网卡驱动设置
# ethtool -i eno1
driver: r8169
version: 5.19.1-051901-generic
firmware-version: rtl8168h-2_0.0.2 02/26/15
expansion-rom-version:
bus-info: 0000:59:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
1.1.4 只展示 Auto-negotiation, RX and TX
# ethtool -a eno1
Pause parameters for eno1:
Autonegotiate: on
RX: off
TX: off# 参数含义如下:
-a --show-pauseQueries the specified Ethernet device for pause parameter information.
1.1.5 展示统计
# ethtool -S eno1
NIC statistics:tx_packets: 6199rx_packets: 16548tx_errors: 0rx_errors: 1rx_missed: 0align_errors: 0tx_single_collisions: 0tx_multi_collisions: 0unicast: 4228broadcast: 10859multicast: 1461tx_aborted: 0tx_underrun: 0
1.1.7 排除网络故障
连接成功后,我们期望 Speed 是明确的值,Duplex 是 Full/Half,Link detection 是 Yes。如果不是(如Speed、Duplex 为 Unknow 时,Link detection 为 No 时),可能交换机或网络设置有问题。
此时可以用 tcpdump 抓包分析。
1.1.8 通过网口的 LED 区分网卡
如果机器有很多网口,设置后,对应的网口即会亮灯,即可区分对应关系
ethtool -p eth0# 参数含义如下:-p --identifyInitiates 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 network port.启动特定于适配器的操作,以使操作员能够轻松地通过视觉识别适配器。这通常涉及闪烁特定网络端口上的一个或多个LED。[N] Length of time to perform phys-id, in seconds.
1.1.9 持久化配置(无需 reboot)
通过 ethtool 设置后,reboot 仍会恢复为设置前的状态。但可通过写配置文件的方式来持久化。
- ubuntu 设置如下:在 /etc/network/interfaces 配置则会持久化。
# vim /etc/network/interfaces
post-up ethtool -s eno1 speed 1000 duplex full autoneg off # 此行应为本文件的最后一行
- SUSE 设置如下:
modify the /etc/sysconfig/network/ifcfg-eth-id file and include a new script using POST_UP_SCRIPT variable as shown below. Include the below line as the last line in the corresponding eth1 adpater config file.
# vim /etc/sysconfig/network/ifcfg-eth-id
POST_UP_SCRIPT='eth1'
Then, create a new file scripts/eth1 as shown below under /etc/sysconfig/network directory. Make sure that the script has execute permission and ensure that the ethtool utility is present under /sbin directory.
# cd /etc/sysconfig/network/# vim scripts/eth1
#!/bin/bash
/sbin/ethtool -s duplex full speed 100 autoneg off
相关文章:
【计算机网络】10、ethtool
文章目录 一、ethtool1.1 常见操作1.1.1 展示设备属性1.1.2 改变网卡属性1.1.2.1 Auto-negotiation1.1.2.2 Speed 1.1.3 展示网卡驱动设置1.1.4 只展示 Auto-negotiation, RX and TX1.1.5 展示统计1.1.7 排除网络故障1.1.8 通过网口的 LED 区分网卡1.1.9 持久化配置(…...
什么是前端工程化?
工程化介绍 什么是前端工程化? 前端工程化是一种思想,而不是某种技术。主要目的是为了提高效率和降低成本,也就是说在开发的过程中可以提高开发效率,减少不必要的重复性工作等。 tip 现实生活举例 建房子谁不会呢?请…...
【深度学习】【三维重建】windows11环境配置tiny-cuda-nn详细教程
【深度学习】【三维重建】windows11环境配置tiny-cuda-nn详细教程 文章目录 【深度学习】【三维重建】windows11环境配置tiny-cuda-nn详细教程前言确定版本对应关系源码编译安装tiny-cuda-nn总结 前言 本人windows11下使用【Instant Neural Surface Reconstruction】算法时需要…...
Matlab 一种自适应搜索半径的特征提取方法
文章目录 一、简介二、实现代码参考资料一、简介 在之前的博客(C++ ID3决策树)中,提到过一种信息熵的概念,其中它表达的大致意思为:香农认为熵是指“当一件事情有多种可能情况时,这件事情发生某种情况的不确定性”,也就是指如果一个事情的不确定性越大,那么这个信息的熵…...
基于opencv的几种图像滤波
一、介绍 盒式滤波、均值滤波、高斯滤波、中值滤波、双边滤波、导向滤波。 boxFilter() blur() GaussianBlur() medianBlur() bilateralFilter() 二、代码 #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> …...
puppeteer代理的搭建和配置
puppeteer代理的搭建和配置 本文深入探讨了Puppeteer在网络爬虫和自动化测试中的重要角色,着重介绍了如何搭建和配置代理服务器,以优化Puppeteer的功能和性能。文章首先介绍了Puppeteer作为一个强大的Headless浏览器自动化工具的优势和应用场景…...
【简单认识MySQL的MHA高可用配置】
文章目录 一、简介1、概述2、MHA 的组成3.MHA 的特点4、MHA工作原理 二、搭建MHA高可用数据库群集1.主从复制2.MHA配置 三、故障模拟四、故障修复步骤: 一、简介 1、概述 MHA(Master High Availability)是一套优秀的MySQL高可用…...
【云原生】一文学会Docker存储所有特性
目录 1.Volumes 1.Volumes使用场景 2.持久将资源存放 3. 只读挂载 2.Bind mount Bind mounts使用场景 3.tmpfs mounts使用场景 4.Bind mounts和Volumes行为上的差异 5.docker file将存储内置到镜像中 6.volumes管理 1.查看存储卷 2.删除存储卷 3.查看存储卷的详细信息…...
Android Ble蓝牙App(一)扫描
Ble蓝牙App(一)扫描 前言正文一、基本配置二、扫描准备三、扫描页面① 增加UI布局② 点击监听③ 扫描处理④ 广播处理 四、权限处理五、扫描结果① 列表适配器② 扫描结果处理③ 接收结果 六、源码 前言 关于低功耗的蓝牙介绍我已经做过很多了࿰…...
mac pd安装ubuntu并配置远程连接
背景 一个安静的下午,我又想去折腾点什么了。准备学习一下k8s的,但是没有服务器。把我给折腾的,在抱怨了:为什么M系列芯片的资源怎么这么少。 好在伙伴说,你可以尝试一下ubantu。于是,我只好在我的mac上安…...
1.3 eureka+ribbon,完成服务注册与调用,负载均衡源码追踪
本篇继先前发布的1.2 eureka注册中心,完成服务注册的内容。 目录 环境搭建 采用eurekaribbon的方式,对多个user服务发送请求,并实现负载均衡 负载均衡原理 负载均衡源码追踪 负载均衡策略 如何选择负载均衡策略? 饥饿加载…...
mysql修改字段长度是否锁表
Varchar对于小于等于255字节以内的长度可以使用一个byte 存储。大于255个字节的长度则需要使用2个byte存储 1, 如果是255长度之内的扩展,或者255之外的扩展,则不锁表,采用in-place方式执行 2, 如果从varchar长度从(0,2…...
SpringCloud集成OpenTelemetry的实现
SpringCloud项目做链路追踪,比较常见的会集成SleuthZipKin来完成,但这次的需求要集成开源框架OpenTelemetry,这里整理下实现过程。相关文章: 【SpringCloud集成SleuthZipkin进行链路追踪】 【OpenTelemetry框架Trace部分整理】 …...
Python爬取IP归属地信息及各个地区天气信息
一、实现样式 二、核心点 1、语言:Python、HTML,CSS 2、python web框架 Flask 3、三方库:requests、xpath 4、爬取网站:https://ip138.com/ 5、文档结构 三、代码 ipquery.py import requests from lxml import etree # 请求…...
RedLock + Redisson
目录 2.9 RedLock2.9.1 上述实现的分布式锁在集群状态下失效的原因2.9.2 解决方式-RedLock 2.10 redisson中的分布式锁2.10.0 redisson简介以及简单使用简单使用redisson中的锁Redisson常用配置 2.10.1 Redisson可重入锁实现原理2.10.2 公平锁(Fair Lock)…...
计算机视觉:卷积层的参数量是多少?
本文重点 卷积核的参数量是卷积神经网络中一个重要的概念,它决定了网络的复杂度和计算量。在深度学习中,卷积操作是一种常用的操作,用于提取图像、语音等数据中的特征。卷积神经网络的优势点在于稀疏连接和权值共享,这使得卷积核的参数相较于传统的神经网络要少很多。 举例…...
Docker 容器基础操作
Docker容器基础操作 容器(container)是Docker镜像的运行实例,类似于可执行文件与进程的关系,Docker是容器引擎,相当于系统平台。 容器的生命周期 容器的基础操作(以 tomcat8.0 为例) # 拉取tomcat8.0镜像 [root@tudou tudou]# docker pull tomcat:8.0 8.0: Pulling f…...
【Vue3+Ts+Vite】配置滚动条样式
一、先看效果 二、直接上代码 <template><div class"main-container"><h1 v-for"index in 50" :key"index">这是home页面</h1></div> </template> <style lang"scss" scoped> .main-conta…...
react map使用方法详解
在React中,map()方法是用于数组的常见方法之一,它可以用于处理数组并返回一个新的数组。在React中,经常使用map()方法来遍历数组,生成对应的组件列表或进行数据转换操作。 下面是map()方法在React中的使用方法详解: …...
PoseiSwap:通过 RWA 的全新叙事,反哺 Nautilus Chain 生态
PoseiSwap 是 Nautilus Chain 上的首个 DEX,作为目前行业内模块化区块链叙事的早期奉行者,PoseiSwap 也得到了较高的市场关注。基于 Nautilus Chain,PoseiSwap 打造了一个全新的 Rollup 应用层,并通过零知识证明来建立全新的订单簿…...
终极指南:ViGEmBus虚拟游戏控制器驱动,Windows游戏输入革命性解决方案
终极指南:ViGEmBus虚拟游戏控制器驱动,Windows游戏输入革命性解决方案 【免费下载链接】ViGEmBus Windows kernel-mode driver emulating well-known USB game controllers. 项目地址: https://gitcode.com/gh_mirrors/vi/ViGEmBus 想要在Windows…...
3分钟让Windows任务栏变透明:TranslucentTB完全指南
3分钟让Windows任务栏变透明:TranslucentTB完全指南 【免费下载链接】TranslucentTB A lightweight utility that makes the Windows taskbar translucent/transparent. 项目地址: https://gitcode.com/gh_mirrors/tr/TranslucentTB 你是否厌倦了Windows系统…...
网安从业者必学 100 个核心知识点,自查进阶必备
100条必背网络安全知识点,你都掌握了吗? 1988年,一款名为“莫里斯蠕虫”的程序悄然传播,它最初是康奈尔大学研究员的实验项目,目的是测量互联网规模。可谁也没想到,这个程序失控后感染了数千台电脑&#x…...
如何快速实现 CoffeeScript 实时编译和预览:vim-coffee-script 终极指南 [特殊字符]
如何快速实现 CoffeeScript 实时编译和预览:vim-coffee-script 终极指南 🚀 【免费下载链接】vim-coffee-script CoffeeScript support for vim 项目地址: https://gitcode.com/gh_mirrors/vi/vim-coffee-script 对于 CoffeeScript 开发者来说&am…...
LangChain 是什么?从零开始学会 LangChain 的工程实践指南
LangChain 是什么?从零开始学会 LangChain 的工程实践指南 1. 文章背景:为什么这个主题重要 在大模型应用开发中,很多人第一次接触 LangChain,是因为想快速做一个“基于大模型的应用”:例如知识库问答、RAG 检索增强生…...
从 0 到 1:10 分钟跑通第一个 Ascend ACL 推理程序
第一次在昇腾 NPU 上跑推理,很多人卡在第一步:环境装好了,ATC 模型转换也成功了,一跑推理程序就报 aclInit failed 或者 load model failed。 我当年第一次跑 ACL 推理,环境装了 3 遍,模型转了 5 遍&#…...
Linux ln 软硬链接详解——底层原理+生产实战+彻底区分(零踩坑)
前言很多新手永远分不清软硬链接,只会背“软链接像快捷方式、硬链接像副本”,一旦遇到生产删文件、日志切割、程序部署就翻车。本文从inode底层原理讲起,配合完整实战、对比、生产场景,让你彻底吃透 ln 软硬链接,面试、…...
选对服务商事半功倍!2026 全国头部综合型设计搭建会展服务商核心优势解读
本文详解 2026 年全国各大会展中心全国头部综合型设计搭建会展服务商的核心优势与价值,核心定义为全国头部综合型设计搭建会展服务商是指具备全产业链整合能力、全国化服务网络、丰富的行业经验与强大的技术实力,能够为客户提供一站式、全流程会展设计搭…...
1987年5月15日中午11-13点出生性格、运势和命运
人们常常对“出生时辰”怀有神秘的好奇,但从现代科学的角度看,出生时间对个体的影响并非玄学,而是可以找到生理学和心理学依据的。1987年4月24日晚上23点到24点之间出生,这个时间点恰好处在夜晚向深夜过渡的时段。抛开任何命理说法…...
TVA:打通数字AI到物理AI的关键桥梁(系列)
重磅预告:本专栏将独家连载系列丛书《智能体视觉技术与应用》部分精华内容,该书是世界首套系统阐述“因式智能体”视觉理论与实践的专著,特邀美国 TypeOne 公司首席科学家、斯坦福大学博士 Bohan 担任技术顾问。Bohan先生师从美国三院院士、“…...
