一,ethtool命令所屬的包
[root@centos8 liuhongdi]# whereis ethtool ethtool: /usr/sbin/ethtool /usr/share/man/man8/ethtool.8.gz [root@centos8 liuhongdi]# rpm -qf /usr/sbin/ethtool ethtool-5.0-2.el8.x86_64
默認情況下centos已自帶了ethtool,
如果找不到此命令,可以用yum安裝
[root@centos8 liuhongdi]# yum install ethtool
說明:劉宏締的架構森林是一個專注架構的博客,地址:https://www.cnblogs.com/architectforest
對應的源碼可以訪問這里獲取: https://github.com/liuhongdi/
說明:作者:劉宏締 郵箱: 371125307@qq.com
二,查看ethtool的版本和幫助:
1,查看版本
[root@centos8 liuhongdi]# ethtool --version ethtool version 5.0
2,查看幫助
[root@centos8 liuhongdi]# ethtool --help
三,查看網卡的信息:
1,命令:
[root@centos8 liuhongdi]# 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: No Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on MDI-X: off (auto) Supports Wake-on: d Wake-on: d Current message level: 0x00000007 (7) drv probe link Link detected: yes
2,輸出字段的說明:
Supported ports: #網卡接口支持的類型,
FIBRE是光纖
TP 是雙絞線,就是普通的RJ45網口 100Base-TX
AUI是粗纜接口 10Base-5
BNC是細纜接口 10Base-2
Supported link modes: #支持的模式有哪些
Supports auto-negotiation: #是否支持自動協商
Speed: #當前速度
Advertised link modes: #通告模式
Advertised auto-negotiation: #通告是否使用自動協商
Duplex: #工作模式,Full為全雙工
Port: #接口類型,Twisted Pair是雙絞線,FIBRE是光纖
Auto-negotiation: #自動協商是否打開,on是打開狀態
Link detected: #是否連接到網絡,yes是激活狀態
Supports Wake-on: d #是否支持Wake On LAN,d:不支持,g:支持
Wake-on: #Wake On LAN是否啟用,d:禁用,g:啟用
Advertised link modes: #Advertise是給自動協商(用來配置速度和模式)的通告
PHYAD:#網卡的物理標識,如果兩個device的PHYAD相同,表示在一塊物理網卡上
四,查看網卡的驅動信息:
1,用-i參數查看驅動信息
[root@centos8 liuhongdi]# 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
說明:
driver: #驅動
version: 版本
firmware-version: 固件版本
五,統計網卡收發包的數據
1,用 -S統計收發包的數據
[root@centos8 liuhongdi]# ethtool -S ens33
六,如果機器上安裝了兩塊網卡,那么eth0對應着哪塊網卡呢?
用 -p參數使網卡的led燈閃爍
操作完畢后,看哪塊網卡的led燈在閃,eth0就對應着哪塊網卡
[root@centos8 liuhongdi]# ethtool -p ens33 10
-p: 檢測ens33這個device對應的物理接口,
10: 10秒時間后停止閃爍
參數的說明:
-p --identify 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 network port. [ N] Length of time to perform phys-id, in seconds.
七,查看收發隊列:
1,用 -g參數查看網卡收發隊列的大小
[root@centos8 liuhongdi]# ethtool -g ens33 Ring parameters for ens33: Pre-set maximums: RX: 4096 #預設最大接收隊列大小 RX Mini: 0 RX Jumbo: 0 TX: 4096 #預設最大發送隊列大小 Current hardware settings: RX: 256 #當前接收隊列大小 RX Mini: 0 RX Jumbo: 0 TX: 256 #當前發送隊列大小
八,相關的說明:
1,自動協商:Auto-Negotiation
它是主動的協商方式,具有這種功能的設備會主動與對方協商,並且等待對端返回協商結果,
它能夠協商兩端的工作速度是10M,還是100M還是1000M,
還可以協商兩端工作的雙工方式是半雙工還是全雙工.
2,Wake On LAN:
用來實現遠程開機
九,本地centos的版本
[root@centos8 conf]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core)