zoukankan      html  css  js  c++  java
  • Ethtool命令

    ethtool 是用于查询及设置网卡参数的命令。

    -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 修改网卡的部分配置,包括网卡速度、单工/全双工模式、mac地址等。加上-s选项修改的内容才会生效
    -S 显示NIC- and driver-specific 的统计参数,如网卡接收/发送的字节数、接收/发送的广播包个数等。
    -t 让网卡执行自我检测,有两种模式:offline or online.
    [root@tym selinux]# ethtool eth0
    Settings for eth0:
            Link detected: yes
    查询网口的驱动相关信息:
    [root@tym tian]# ethtool -i eth0
    driver: virtio_net
    version: 1.0.0
    firmware-version:
    expansion-rom-version:
    bus-info: 0000:00:03.0
    supports-statistics: no
    supports-test: no
    supports-eeprom-access: no
    supports-register-dump: no
    supports-priv-flags: no
    

      

    查看网卡,在接收/发送数据时,有没有出错 :
    [root@tym tian]# ethtool -S eth0
    no stats available
    停止网卡的发送模块TX:
    ethtool -A tx off eth0

    查看网线是否连接:

    for aa in `ip a | egrep "UP|down" |egrep "eth0" |awk -F: '{print $2}'`;do ethtool $aa;done |grep 'Link detected'
     Link detected: yes
    #结果为yes表示网线连接正常
  • 相关阅读:
    EC++学习笔记(五) 实现
    EC++学习笔记(三) 资源管理
    EC++学习笔记(一) 习惯c++
    EC++学习笔记(六) 继承和面向对象设计
    STL学习笔记(三) 关联容器
    STL学习笔记(一) 容器
    背包问题详解
    EC++学习笔记(二) 构造/析构/赋值
    STL学习笔记(四) 迭代器
    常用安全测试用例
  • 原文地址:https://www.cnblogs.com/t-ym/p/14778835.html
Copyright © 2011-2022 走看看