CentOS网卡状态查看及设置

来源:互联网 发布:黑龙江省网络教育 编辑:程序博客网 时间:2024/05/18 00:12

问题

偶然发现实验室有一台作存储的服务器局域网内的连接速度只有100M,但是实验室用的是千兆交换机服务器也是千兆网卡并且其它同类型同用途的服务器局域网速度都达到了千兆, 因此一个问题就出来了,怎样查看服务器的网卡设备,当前连接速度,速度怎么调节?相关文档网卡已经有许多,我也就不哆嗦了,这里列几篇供参考:

http://www.lishiming.net/thread-826-1-1.html

http://blog.chinaunix.net/uid-20149676-id-1733254.html

http://tonychiu.blog.51cto.com/656605/425391

解决过程

服务器网卡信息如下,从这里我们看到网卡是支持千兆的,但实际的连接速度只有百兆,作为存储服务器,这损失大了去了。

[root@store3 ~]# ethtool eth0Settings 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 pause frame use: No        Advertised auto-negotiation: Yes        Speed: 100Mb/s        Duplex: Full        Port: Twisted Pair        PHYAD: 1        Transceiver: internal        Auto-negotiation: on        MDI-X: Unknown        Supports Wake-on: g        Wake-on: g        Link detected: yes

这里我主要使用ethtool进行设置,可是设置完成后速度并没有变化

[root@store3 ~]# ethtool -s eth0 speed 1000[root@store3 ~]# ethtool eth0Settings 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 pause frame use: No        Advertised auto-negotiation: Yes        Speed: 100Mb/s        Duplex: Full        Port: Twisted Pair        PHYAD: 1        Transceiver: internal        Auto-negotiation: on        MDI-X: Unknown        Supports Wake-on: g        Wake-on: g        Link detected: yes

使用命令ethtool -s eth0 duplex full autoneg off speed 1000报参数错误,多次折腾后发现使用ethtool -s eth0 autoeng off后可以设置使用命令 ethtool -s eth0 speed N设置网速为10或100,但改为1000时报参数错误。经过多次尝试,最后的最后竟然发现是网线的问题!!!换完网速就上去了,无语。 虽然最后问题是出在了网线上,但至少还是学会了怎么查看网卡状态及简单的设置,还是值得记录一下的。

北方工业大学 | 云计算研究中心 | 姜永