2010年7月7日 星期三

利用ethtool對網卡限速

因架設Lustre環境,想確認分散式架構對performance是否真的有助益,但沒有10G或InfiniBand等架構,效能都卡在網路頻寬,故想到用降低網路速率來測分散式是否真有助益...


網路上查了一下,可以使用ethtool工具進行..
---------------------
#ethtool
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 auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: g
Current message level: 0x00000003 (3)
Link detected: yes
----------------------

目前的網路速度為1000Mb/s。

於是下達
ifdown eth0;ethtool -s eth0 speed 10;ifup eth0

結果失敗,速度仍為1000。
於是修改網卡配置文件
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
添加一行
ETHTOOL_OPTS="speed 10 duplex full autoneg off"

就搞定.
--------------------
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: Not reported
Advertised auto-negotiation: No
Speed: 10Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: umbg
Wake-on: g
Current message level: 0x00000003 (3)
Link detected: yes
--------------------

參考至Lyychee's Blog


....繼續閱讀