ethtool使用记录

网卡出现很诡异的问题,把电脑连到一些交换机上是工作的,连到另外一些就不行。。。交换机上的link灯还时不时的闪一下,看起来像是在尝试连接。

用dmesg查看,看到下面的信息:

[ 1112.922110] jme 0000:05:00.5: irq 46 for MSI/MSI-X [ 1112.944596] jme 0000:05:00.5: eth0: Link is down [ 1112.945228] ADDRCONF(NETDEV_UP): eth0: link is not ready

查了半天,也没弄明白是怎么回事,有人说是驱动问题。另外看到有人推荐用ethtool来强制定义为100M以太网。方法如下

sudo ethtool -s eth0 speed 100 duplex full autoneg off

设置后的效果,可以使用sudo ethtool eth0来查看。比如,我设置之前是

Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 1 Transceiver: internal Auto-negotiation: off Supports Wake-on: pg Wake-on: d Current message level: 0x000020c6 (8390) probe link rx_err tx_err hw Link detected: no

设置之后是:

Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 1 Transceiver: internal Auto-negotiation: off Supports Wake-on: pg Wake-on: d Current message level: 0x000020c6 (8390) probe link rx_err tx_err hw Link detected: yes

其中,最后Link detected是表示是否已检测到有以太网连接的。。。说明强制100M之后,就连上了。。。

 

不知道这是为什么,反正100M也能适应大多是情况了,先暂且如此。

你可能感兴趣的:(tool)