CentOS网卡状态查看及设置

本文档记录了在CentOS系统中,遇到服务器网卡速度只有100M而非预期的千兆问题。通过查看网卡信息和使用`ethtool`命令进行设置,最终发现是网线问题导致的连接速度限制。解决问题后,了解到如何查看和调整网卡状态,具有一定的参考价值。

问题

偶然发现实验室有一台作存储的服务器局域网内的连接速度只有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 eth0
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 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 eth0
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 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时报参数错误。经过多次尝试,最后的最后竟然发现是网线的问题!!!换完网速就上去了,无语。 虽然最后问题是出在了网线上,但至少还是学会了怎么查看网卡状态及简单的设置,还是值得记录一下的。

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值