Linux命令之Ethtool用法详解

原文:http://www.linuxidc.com/Linux/2012-01/52669.htm

Linux/Unix命令之Ethtool
描述:
Ethtool是用于查询及设置网卡参数的命令。
概要:
ethtool ethX      //查询ethX网口基本设置
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]\         //设置网口速率10/100/1000M
[duplex half|full]\           //设置网口半/全双工
[autoneg on|off]\            //设置网口是否自协商
[port tp|aui|bnc|mii]\         //设置网口类型
[phyad N]\                 
[xcvr internal|exteral]\
[wol p|u|m|b|a|g|s|d...]\
[sopass xx:yy:zz:aa:bb:cc]\
[msglvl N]
举例:
1)[root@linux /]# ethtool eth1

Settings for eth0:
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: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Link detected: yes

2)[root@linux /]# ethtool -i eth1

driver: bnx2
version: 2.0.8-rh
firmware-version: 6.2.12 bc 5.2.3 NCSI 2.0.11
bus-info: 0000:01:00.0

3)[root@linux /]# ethtool -S eth1
 NIC statistics:

     rx_bytes: 216494818
     rx_error_bytes: 0
     tx_bytes: 27084170553
     tx_error_bytes: 0
     rx_ucast_packets: 2933822
     rx_mcast_packets: 33
     rx_bcast_packets: 956
     tx_ucast_packets: 18464909
     tx_mcast_packets: 6
     tx_bcast_packets: 179
     tx_mac_errors: 0
     tx_carrier_errors: 0
     rx_crc_errors: 0
     rx_align_errors: 0
     tx_single_collisions: 0
     tx_multi_collisions: 0
     tx_deferred: 0
     tx_excess_collisions: 0
     tx_late_collisions: 0
     tx_total_collisions: 0
     rx_fragments: 0
     rx_jabbers: 0
     rx_undersize_packets: 0
     rx_oversize_packets: 0
     rx_64_byte_packets: 959
     rx_65_to_127_byte_packets: 2930241
     rx_128_to_255_byte_packets: 2634
     rx_256_to_511_byte_packets: 752
     rx_512_to_1023_byte_packets: 169
     rx_1024_to_1522_byte_packets: 56
     rx_1523_to_9022_byte_packets: 0
     tx_64_byte_packets: 183
     tx_65_to_127_byte_packets: 357
     tx_128_to_255_byte_packets: 750
     tx_256_to_511_byte_packets: 224
     tx_512_to_1023_byte_packets: 991032
     tx_1024_to_1522_byte_packets: 17472548
     tx_1523_to_9022_byte_packets: 0
     rx_xon_frames: 0
     rx_xoff_frames: 0
     tx_xon_frames: 0
     tx_xoff_frames: 0
     rx_mac_ctrl_frames: 0
     rx_filtered_packets: 0
     rx_ftq_discards: 0
     rx_discards: 0
     rx_fw_discards: 0

4)[root@linux /]# ethtool -s eth1 autoneg off speed 100 duplex full
相关:
1)[root@linux /]# which ethtool
    /sbin/ethtool
2)[root@linux /]# rpm -qf /sbin/ethtool
   ethtool-1.6-5
3)怎样使ethtool设置永久保存在网络设备中?
   解决方法一:
    ethtool设置可通过/etc/sysconfig/network-scripts/ifcfg-ethX文件保存,从而在设备下次启动时激活选项。 
例如:ethtool -s eth0 speed 100 duplex full autoneg off
此指令将eth0设备设置为全双工自适应,速度为100Mbs。若要eth0启动时设置这些参数, 修改文件/etc/sysconfig/network-scripts/ifcfg-eth0 ,添加如下一行: 
ETHTOOL_OPTS="speed 100 duplex full autoneg off"
解决方法二:
将ethtool设置写入/etc/rc.d/rc.local之中。

解决方法:
对Intel千兆网卡禁用自适应时必须指定链路速度和全双工模式。当使用ethtool来禁用使用e1000网卡驱动模块的网卡自适应特性时,必须同时指定链路速度和全双工工作模式。例如: ethtool -s eth0 autoneg off

会边比自适应,但是只是临时禁用,如果在命令中没有指定链路速度和全双工工作模式,驱动会自动重新打开自适应。 
为了使用ethtool工具来禁用e1000网卡驱动模块的网卡自适应特性,使用以下步骤 
1. 进入终端模式。 2. 以root身份执行 ethtool -s ethx autoneg off speed 1000 duplex full
这里ethX是网卡的名字(例如eth0或者eth1等等),这个命令将关闭该网卡的自适应特性,并且强制设置网卡速度为1Gb,全双公模式。
另外ethtool比mii-tool要高级,mii-tool只支持 Port: MII的网卡.

(转)Linux命令之Ethtool用法详解的更多相关文章

  1. LINUX命令之ETHTOOL用法详解

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

  2. Linux命令之grep用法详解:grep与正则表达式 [转]

    正则表达式与通配符不一样,它们表示的含义并不相同. grep命令的选项用于对搜索过程进行补充说明.grep命令的模式十分灵活,可以是字符串.变量,还可以是正则表达式. 无论模式是何种形式,只要模式中包 ...

  3. linux管道命令grep命令参数及用法详解---附使用案例|grep

    功能说明:查找文件里符合条件的字符串. 语 法:grep [-abcEFGhHilLnqrsvVwxy][-A<显示列数>][-B<显示列数>][-C<显示列数>] ...

  4. linux mount命令参数及用法详解

    linux mount命令参数及用法详解 非原创,主要来自 http://www.360doc.com/content/13/0608/14/12600778_291501907.shtml. htt ...

  5. 【转】linux expr命令参数及用法详解

    在抓包过程中,查看某个设定时间内,数据上下行多少,用命令expr 计算! --------------------------------------------------------------- ...

  6. linux useradd(adduser)命令参数及用法详解(linux创建新用户命令)

    linux useradd(adduser)命令参数及用法详解(linux创建新用户命令) useradd可用来建立用户帐号.帐号建好之后,再用passwd设定帐号的密码.而可用userdel删除帐号 ...

  7. linux dmesg命令参数及用法详解(linux显示开机信息命令)

    linux dmesg命令参数及用法详解(linux显示开机信息命令) http://blog.csdn.net/zhongyhc/article/details/8909905 功能说明:显示开机信 ...

  8. linux sed命令参数及用法详解

    linux sed命令参数及用法详解 http://blog.csdn.net/namecyf/article/details/7336308 1. Sed简介 sed 是一种在线编辑器,它一次处理一 ...

  9. linux dd命令参数及用法详解---用指定大小的块拷贝一个文件(也可整盘备份)

    linux dd命令参数及用法详解---用指定大小的块拷贝一个文件 日期:2010-06-14 点击:3830 来源: 未知 分享至:            linux dd命令使用详解 dd 的主要 ...

随机推荐

  1. listen 80

    Facebook Quietly Created New Email Addresses For a company that made its name by building one of the ...

  2. 语义化npm版本号

    参考资料: 语义化版本2.0.0 the semantic versioner for npm 在package的devDependencies和dependencies2个字段中有指定依赖包版本,这 ...

  3. inode、软连接、硬链接

    一.inode是什么? 理解inode,要从文件储存说起.文件储存在硬盘上,硬盘的最小存储单位叫做"扇区"(Sector).每个扇区储存512字节(相当于0.5KB).操作系统读取 ...

  4. PyNLPIR python中文分词工具

    官网:https://pynlpir.readthedocs.io/en/latest/  github:https://github.com/tsroten/pynlpir          NLP ...

  5. 使用mutt+msmtp做linux邮件客户端

      下载MSMTP wget http://nchc.dl.sourceforge.net/sourceforge/msmtp/msmtp-1.4.17.tar.bz2 tar xvf msmtp-1 ...

  6. CodeForces - 1000E :We Need More Bosses(无向图缩点+树的直径)

    Your friend is developing a computer game. He has already decided how the game world should look lik ...

  7. MySQL三个列组成唯一值查询_开源中国问题练习_20161026

    问题地址:https://www.oschina.net/question/2923955_2202674 按 service_collect_day分类以后,按 app_id,node_id,ser ...

  8. mac hosts

    1 在命令行中输入:sudo vim /etc/hosts. 2 输入开机密码,就可打开文件.按下键盘i,对文件进入可编辑状态. 3 修改完,先按esc退出编辑模式,之后,按shift+:,再按wq来 ...

  9. poj1135Domino Effect——最短路

    题目:http://poj.org/problem?id=1135 先在图中跑一遍最短路,最后倒的牌可能是dis值最大的点,也可能是在dis值最大的点所连的边上,尝试一下即可: 坑:n=1的时候输出点 ...

  10. 锐捷认证的一些问题&解决方法

    scau锐捷校园网各种无法吐槽,认证有时候自己掉线了麻痹都打到boss了给我掉线,收费也坑爹,连铁通都比不上. 1.锐捷认证客户端已停止工作: 貌似是毒霸的问题,把金山毒霸关掉再试 2.获取ip地址信 ...