linux下ethtool的使用

Posted wmate

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux下ethtool的使用相关的知识,希望对你有一定的参考价值。

1、使用ifconfig查看当前网卡

/ # ifconfig
bridge0   Link encap:Ethernet  HWaddr 4A:B3:0C:01:C1:8B  
          inet addr:172.31.234.26  Bcast:172.31.234.27  Mask:255.255.255.252
          inet6 addr: fe80::48b3:cff:fefe:be88/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2752 errors:0 dropped:0 overruns:0 frame:0
          TX packets:745 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:192468 (187.9 KiB)  TX bytes:47651 (46.5 KiB)

eth0      Link encap:Ethernet  HWaddr 00:80:48:BA:D1:30  
          inet addr:169.254.4.1  Bcast:169.254.4.255  Mask:255.255.255.0
          inet6 addr: fe80::280:48ff:feba:d130/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4867 errors:5 dropped:9 overruns:0 frame:2
          TX packets:715 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:490146 (478.6 KiB)  TX bytes:58813 (57.4 KiB)
          Interrupt:108 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:400 (400.0 B)  TX bytes:400 (400.0 B)

2、使用ethtool eth0查看网卡信息

/ # ethtool eth0
Settings for eth0:
    Supported ports: [ TP MII ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: Symmetric Receive-only
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: Symmetric Receive-only
    Advertised auto-negotiation: Yes
    Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                         100baseT/Half 100baseT/Full 
    Link partner advertised pause frame use: No
    Link partner advertised auto-negotiation: Yes
    Speed: 100Mb/s
    Duplex: Full
    Port: MII
    PHYAD: 0
    Transceiver: external
    Auto-negotiation: on
    Supports Wake-on: pg
    Wake-on: p
    Current message level: 0x00007fff (32767)
                   drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol
    Link detected: yes

3、修改网卡配置

ethtool -s eth0 speed 10 duplex full autoneg off

将网卡eth0对应的物理端口设置为速率10Mbps,全双工工作模式,关闭自动协商。

4、查看网卡信息,配置成功

/ # ethtool eth0
Settings for eth0:
    Supported ports: [ TP MII ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: Symmetric Receive-only
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Full 
    Advertised pause frame use: Symmetric Receive-only
    Advertised auto-negotiation: No
    Speed: 10Mb/s
    Duplex: Full
    Port: MII
    PHYAD: 0
    Transceiver: external
    Auto-negotiation: off
    Supports Wake-on: pg
    Wake-on: p
    Current message level: 0x00007fff (32767)
                   drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol
    Link detected: yes

 

以上是关于linux下ethtool的使用的主要内容,如果未能解决你的问题,请参考以下文章

linux 下mii-tool ethtool 命令简单的使用

Linux - ethtool 使用方法

linux 网卡状态命令mii-tool 和 ethtool

Linux命令之ethtool命令

用ethtool确定多网卡Linux服务器网口位置

Linux命令之ethtool命令