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. 详细介绍Linux shell脚本基础学习

    Linux shell脚本基础学习这里我们先来第一讲,介绍shell的语法基础,开头.注释.变量和 环境变量,向大家做一个基础的介绍,虽然不涉及具体东西,但是打好基础是以后学习轻松地前提.1. Lin ...

  2. 浏览器兼容问题----Firefox不兼容event的解决方法

    一.event.srcElement:当前事件的源: 在IE下,event对象有srcElement属性,但是没有target属性;Firefox下,event对象有target属性,但是没有srcE ...

  3. cmake简易教程

    用cmake替代makefile,构建项目还是蛮简单实用的. 工程目录下src放源代码,build保存所有的编译过程和结果. 首先看看src目录下的源代码结构: 最顶层CMakeLists.txt内容 ...

  4. WinForm控件复杂数据绑定常用数据源(对Combobox,DataGridView等控件DataSource赋值的多种方法)

    开始以前,先认识一下WinForm控件数据绑定的两种形式,简单数据绑定和复杂数据绑定. 1) 简单数据绑定 简单的数据绑定是将用户控件的某一个属性绑定至某一个类型实例上的某一属性.采用如下形式进行绑定 ...

  5. javascript闭包传参和事件的循环绑定

    今天看到一个javascript的题目,按常理循环绑定事件,但是得到的结果却不是想要的. <a href="#">text</a><br>< ...

  6. 博客系统-3.0CodeIgniter系统SAE版本的配置 application/config/

    autoload.php(系统启动时自动加载的文件:包,类库,驱动,方法助手,配置) $autoload['libraries'] = array('database', 'access', 'pag ...

  7. Mysql 数据库表操作

    ☞ 创建表CREATE TABLE `数据库`.`表` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT COMMENT '注释',`type_name` VARCHA ...

  8. c++清除输入缓冲区之 sync() vs ignore()

    最近在写程序的时候总是不注意输入缓冲区内是否还有东西,导致出现了一些异常,调试了半天.所以来上一贴,学习注意,引以为戒! http://blog.chinaunix.net/uid-21254310- ...

  9. Quartz源码阅读

    基于Quartz1.8.5的源码解读 首先看一个demo //简单的任务管理类 //QuartzManager.java package quartzPackage; import java.text ...

  10. open files

    /* * * Copyright (c) International Business Machines Corp., 2001 * * This program is free software; ...