ethtool是设置网卡属性、IP/TCP相关协议属性的基本工具,功能还是很强大的。ubuntu的版本里没有默认集成,使用apt-get install 安装之。。。。

使用概要:
ethtool ethx       //查询ethx网口基本设置,其中 x 是对应网卡的编号,如eth0、eth1等等
ethtool –h        //显示ethtool的命令帮助(help)
ethtool –i ethX    //查询ethX网口的相关信息 
ethtool –d ethX    //查询ethX网口注册性信息
ethtool –r ethX    //重置ethX网口到自适应模式
ethtool –S ethX    //查询ethX网口收发包统计
ethtool –s ethX [speed 10|100|1000] [duplex half|full]  [autoneg on|off]        //设置网口速率10/100/1000M、设置网口半/全双工、设置网口是否自协商

ethtool -k      //查看protocol offload的属性

ethtool -K|--offload DEVNAME Set protocol offload  // 设置protocol offload的属性,这个命令很强大,待会再讲

[ rx on|off ]
[ tx on|off ]
[ sg on|off ]
[ tso on|off ]
[ ufo on|off ]
[ gso on|off ]
[ gro on|off ]
[ lro on|off ]
[ rxvlan on|off ]
[ txvlan on|off ]
[ ntuple on|off ]
[ rxhash on|off ]

使用举例:

1)[root@linux /]# ethtool eth1
   Settings for eth1:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes: 10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: umbg
        Wake-on: d
        Link detected: yes

2)[root@linux /]# ethtool -i eth1
   driver: e1000
   version: 5.0.43-k1
   firmware-version: N/A
   bus-info: 06:08.1

3)[root@linux /]# ethtool -S eth1
   NIC statistics:
     rx_packets: 58068300
     tx_packets: 87124083
     rx_bytes: 1589713008
     tx_bytes: 2165825901
     rx_errors: 0
     tx_errors: 0
     rx_dropped: 0
     tx_dropped: 0
     multicast: 0
     collisions: 0
     rx_length_errors: 0
     rx_over_errors: 0
     rx_crc_errors: 0
     rx_frame_errors: 0
     rx_fifo_errors: 0
     rx_missed_errors: 0
     tx_aborted_errors: 0
     tx_carrier_errors: 0
     tx_fifo_errors: 0
     tx_heartbeat_errors: 0
     tx_window_errors: 0

4) 把网卡eth0 速度改为10Mb/s,采用半双工;

[root@cuc03 beinan]# ethtool -s eth1 speed 10 duplex half
[root@cuc03 beinan]# ethtool eth1
Settings for eth1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: No
Speed: 10Mb/s 注:速度 10M/s
Duplex: Half 注:半双工
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: no 注:eth1没有激活; 5)把网卡eth0 速度改为100Mb/s,采用全双工;
[root@cuc03 beinan]# ethtool -s eth1 speed 100 duplex full 
[root@cuc03 beinan]# ethtool eth1
Settings for eth1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: No
Speed: 100Mb/s 注:速度 100M/s
Duplex: Full 注:全双工
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: no 注:eth1网卡没有激活; 6) 最后关于这个ethtool -k eth0 就特别说明一下,这个是显示网卡的一些特别的协议开关

root@node4:/home/fbw# ethtool -k eth0
Offload parameters for eth0:
rx-checksumming: on
tx-checksumming: off
scatter-gather: off
tcp-segmentation-offload: off
udp-fragmentation-offload: off
generic-segmentation-offload: off
generic-receive-offload: on
large-receive-offload: off
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off
receive-hashing: on

   特别注意,加红的那个参数,之前看到别人遇到这个问题,在部署OpenStack的计算节点的时候,如何将computer部署在台式机上,ssh连接虚拟机就特别卡,连接超时将近1多钟,但是如果将其部署在刀片上就没有任何问题。于是,后面将问题定位到台式机的BCM的网卡上,发现只要敲一下 ethtool -K eth0 tx off ,即只要关掉包发送校检和,就可以正常ssh连接。

ethtool的基本设置的更多相关文章

  1. Linux ethtool命令

    一.简介 ethtool 是用于查询及设置网卡参数的命令. 二.常用选项 ethtool ethx //查询ethx网口基本设置,其中 x 是对应网卡的编号,如eth0.eth1等等 ethtool ...

  2. ethtool 命令详解

    命令描述: ethtool 是用于查询及设置网卡参数的命令. 使用概要:ethtool ethx       //查询ethx网口基本设置,其中 x 是对应网卡的编号,如eth0.eth1等等 转自: ...

  3. 无线网卡的查看与配置——iw,iwconfig,ethtool

    摘要:在linux上,我们经常需要把一台笔记本设置成一个共享wifi上网的路由器.如果我们需要把本机配置成一台无线AP,就需要查看网卡的相关信息和进行对应配置.其中iw.iwconfig和ethtoo ...

  4. LINUX命令之ETHTOOL用法详解

    转载:http://crazyming.blog.51cto.com/1048571/738022 debian 下安装: sudo apt-get install ethtool 或者下载源码编译: ...

  5. 【转】ethtool 命令详解

    命令描述: ethtool 是用于查询及设置网卡参数的命令. 使用概要:ethtool ethx       //查询ethx网口基本设置,其中 x 是对应网卡的编号,如eth0.eth1等等etht ...

  6. 用ethtool 命令解决Linux 网卡丢包【转】

    转自:https://blog.csdn.net/chengxuyuanyonghu/article/details/73739516 生产中有一台Linux设备并发比较大,droped包比较多,尤其 ...

  7. Linux ethtool 命令

    ethtool 是用于查询及设置网卡参数的命令,常见用法如下: 注意:该命令只是临时设置,如果网卡重启就失效了,如果想要永久保存应该配置 /etc/sysconfig/network-scripts/ ...

  8. [转]mii-tool与ethtool的用法详解

    1.mii-tool 配置网络设备协商方式的工具: 感谢原文作者!原文地址:http://blog.chinaunix.net/uid-20639775-id-154546.html 1.1 mii- ...

  9. ethtool命令详解

    命令描述: ethtool 是用于查询及设置网卡参数的命令. 使用概要:ethtool ethx       //查询ethx网口基本设置,其中 x 是对应网卡的编号,如eth0.eth1等等etht ...

随机推荐

  1. (五)Struts2 标签

    所有的学习我们必须先搭建好Struts2的环境(1.导入对应的jar包,2.web.xml,3.struts.xml) 第一节:Struts2 标签简介 Struts2 自己封装了一套标签,比JSTL ...

  2. html-----002

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. ecshop添加自定义lbi文件

    1.找到 admin下面 includes\lib_template.php 找到 $page_libs = array( 这里…. 给您需要的页面加上 你自己的 boke365.lbi 2.找到 l ...

  4. 修改hosts使用谷歌服务

    原文链接如下: http://www.findspace.name/res/72#_1

  5. 「译」如何正确学习JavaScript

    原文:How to Learn JavaScript Properly 目录 不要这样学习JavaScript 本课程资源 1-2周(简介,数据类型,表达式和操作符) 3~4周(对象,数组,函数,DO ...

  6. php中foreach()函数与Array数组经典案例讲解

    //php中foreach()函数与Array数组经典案例讲解 function getVal($v) { return $v; //可以加任意检查代码,列入要求$v必须是数字,或过滤非法字符串等.} ...

  7. input 标签的class 失效

    今天CSS网页的是时候,动态添加input class属性失效, 检查原因是因为之前对此input 使用了  input[type='checkbox'] 应该给其定义一个CLASS,其后面动态添加C ...

  8. maya 写UI 用到的工具

    import os cmds.window() scrollLayout = cmds.scrollLayout(w=150) cmds.gridLayout( numberOfColumns=30, ...

  9. iOS: 神奇的addSubView

    看着addSubView, 本以为是添加多个对象, 但通过测试代码, 发现同一个对象在addSubView中只会添加一次. 想想, 视图对象是通过引用得到的. 在视图的子视图集中, 只保存一个相应的对 ...

  10. uboot移植之环境变量在NandFlash

    一.概述 u-boot环境变量可以设置在Norflash上,也可以在NandFlash上. 倘若环境变量在NorFlash上,再假设S3C2440从NorFlash启动,是能正确从NorFlash上读 ...