zoukankan      html  css  js  c++  java
  • centos8平台使用ethtool配置网卡

    一,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) 
  • 相关阅读:
    FCKeditor 2.6.4在ASP.NET中的安装、配置方法【转】 Fred
    框架页中针对IE6自适应宽度,不出现横向滚动条 Fred
    安装中文VS2008 SP1 和.NETFRAMEWORK 3.5SP1后智能提示是英文的解决办法 Fred
    .Net转义字符[转] Fred
    ReportViewer无法直接打印 Fred
    ASP.NET MVC 官方教程 Fred
    修改SQL Server 2005 sa用户密码的方法 Fred
    数据类型/对象类型介绍(1)NSString
    关于Chrome沙箱技术(沙盒技术)
    UITableView cell自定义视图中插入Table实现复杂界面
  • 原文地址:https://www.cnblogs.com/architectforest/p/12625272.html
Copyright © 2011-2022 走看看