Linux 手動調整 25GbE 為 10GbE
有時候需要直接指定介面為 10GbE,先查詢一下目前網路介面支援的速度:
[root@liho ~]# ethtool ens10f0np0
Settings for ens10f0np0:
Supported ports: [ FIBRE ]
Supported link modes: 1000baseKX/Full
10000baseKR/Full
25000baseCR/Full
25000baseKR/Full
25000baseSR/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Supported FEC modes: None RS BASER
Advertised link modes: 1000baseKX/Full
10000baseKR/Full
25000baseCR/Full
25000baseKR/Full
25000baseSR/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Advertised FEC modes: None RS BASER
Speed: 10000Mb/s
Duplex: Full
Auto-negotiation: on
Port: FIBRE
PHYAD: 0
Transceiver: internal
Supports Wake-on: g
Wake-on: g
Current message level: 0x00000004 (4)
link
Link detected: yes
目前跑在 10Gb 的速度。如果不想要讓他跑別的速度,可以用下列指令讓網路只跑 10GbE:
[root@liho ~]# ethtool -s ens10f0np0 autoneg on speed 10000 duplex full
[root@liho ~]# ethtool ens10f0np0
Settings for ens10f0np0:
Supported ports: [ FIBRE ]
Supported link modes: 1000baseKX/Full
10000baseKR/Full
25000baseCR/Full
25000baseKR/Full
25000baseSR/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Supported FEC modes: None RS BASER
Advertised link modes: 10000baseKR/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Advertised FEC modes: None RS BASER
Speed: 10000Mb/s
Duplex: Full
Auto-negotiation: on
Port: FIBRE
PHYAD: 0
Transceiver: internal
Supports Wake-on: g
Wake-on: g
Current message level: 0x00000004 (4)
link
Link detected: yes
上面的設定. 不管怎麼換 GBICs 1G or 25G 都只能跑 10GbE。
如果想恢復原本可以跑多種速度可以先查 ethtool 的 man pages 說明:
[root@liho ~]# man ethtool
.
.
.
(omit)
advertise N
Sets the speed and duplex advertised by autonegotiation. The argument is a hexadecimal value using one or a combination of the following values:
0x001 10baseT Half
0x002 10baseT Full
0x004 100baseT Half
0x008 100baseT Full
0x80000000000000000 100baseT1 Full
0x40000000000000000000000 100baseFX Half
0x80000000000000000000000 100baseFX Full
0x010 1000baseT Half (not supported by IEEE standards)
0x020 1000baseT Full
0x20000 1000baseKX Full
0x20000000000 1000baseX Full
0x100000000000000000 1000baseT1 Full
0x8000 2500baseX Full (not supported by IEEE standards)
0x800000000000 2500baseT Full
0x1000000000000 5000baseT Full
0x1000 10000baseT Full
0x40000 10000baseKX4 Full
0x80000 10000baseKR Full
0x100000 10000baseR_FEC
0x40000000000 10000baseCR Full
0x80000000000 10000baseSR Full
0x100000000000 10000baseLR Full
0x200000000000 10000baseLRM Full
0x400000000000 10000baseER Full
0x200000 20000baseMLD2 Full (not supported by IEEE standards)
0x400000 20000baseKR2 Full (not supported by IEEE standards)
0x80000000 25000baseCR Full
0x100000000 25000baseKR Full
0x200000000 25000baseSR Full
.
.
.
(omit)
把你要的速度加總,例如:0x20000 + 0x80000 + 0x80000000 + 0x100000000 + 0x200000000 = 0x3800a0000 就可以使用下列指令還原本來的速度:
[root@liho ~]# ethtool -s ens10f0np0 advertise 0x3800a0000