一、问题产生
斐讯N1硬件配置有千兆网口。但是使用中发现千兆交换机只运行在百兆速度上。
检查设备端,发现在CoreELEC 9.0.2中默认按照百兆的速度在跑。
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: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Link partner advertised pause frame use: Symmetric Receive-only
Link partner advertised auto-negotiation: Yes
Link partner advertised FEC modes: Not reported
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: external
Auto-negotiation: on
Supports Wake-on: ug
Wake-on: d
Current message level: 0x0000003d (61)
drv link timer ifdown ifup
Link detected: yes
Speed:100Mb/s
二、变量控制
斐讯N1使用了一颗RTL8211F芯片,网口8线全通,硬件支援千兆没问题。
分别测试了 Cat.5e / Cat.6 (超五类,六类线),确定此问题不是由于线缆问题导致(鉴于Link partner advertised link modes 显示只支持到100Mbps)
网络速度遵循短板原理,如果硬件上都达到千兆所需,那就是软体问题:自动协商(advertised auto-negotiation)功能导致其只工作在100Mbps模式上。
三、问题解决
关闭自动协商,强制指定网卡工作在1000Mbps,全双工模式下
执行指令
ethtool -s eth0 speed 1000 duplex full autoneg off
大约30秒之后执行成功,使用ethtool检查其状态
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: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: external
Auto-negotiation: off
Supports Wake-on: ug
Wake-on: d
Current message level: 0x0000003d (61)
drv link timer ifdown ifup
Link detected: yes
Speed:1000Mb/s
成功
不过由于设备自身IO短板,实际速度大约24MBytes/s左右,那就是另一回事了。