Leif160519的blog Leif160519的blog

——————

目录
linux下怎么判断网卡速率?
/  

linux下怎么判断网卡速率?


本文摘自:https://blog.csdn.net/liugongfeng/article/details/50263733

我们都知道ifconfig -a 可以列出所有网卡,但是怎么判读是千兆网卡还是百兆网卡呢?

1. 判断是千兆网卡还是百兆网卡

ethtool ethx 查看支持的速率
image.png

实际网卡速率可以看Speed 100Mb/s;问题来了,是不是千兆网卡Speed一定是1000M呢?

不一定哟,网卡速率和网线,交换机端口速率都有关系,看到Auto-negotiation字段了吧,on表示开启

自动协商,插上网线后会两端会自动协商一个都支持的速率;

2. Link detected 代表什么呢?

以前就知道yes 表示网卡插好网线了(亮了),反过来呢?是不是插好网线就是yes

不是这样的,插好网线,还要激活网卡(ifup ethx, 其实是二层up)才会yes;

3. 一个类似命令mii-tool, 查看连接状态和速率

image.png

问题来了,如果ethtool 和mii-tool查出来的速率不同呢?

 曾经有个千兆网卡,二者查出的速率不同,多方查阅,终于在man mii-tool发现了结果

 This program is obsolete. Valid media are only 100baseT4, 100baseTx-FD,100baseTx-HD, 10baseT-FD and 10baseT-HD ethernet cards. For replacement check ethtool.

如果你也遇到这个问题,不要犹豫,果断相信ethtool的结果吧。

4. 查看网卡驱动 1ethtool -i ethx`

image.png

也可以用 lspci -vvv

image.png

5. 查看网卡型号,也可以看出千兆还是万兆

image.png


“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill

标  题linux下怎么判断网卡速率?
作  者Leif160519
出  处https://github.icu/articles/2019/08/29/1567066824619.html
关于博主:坐标南京,运维工程师,如有问题探讨可以直接下方留言。
声援博主:如果您觉得文章对您有帮助,可以评论、订阅、收藏。您的鼓励是博主的最大动力!