ethtool 限制接口速度错误

-1 ubuntu ethtool bandwidth-control

我使用 ethtool 限制我的带宽,并且使用了以下命令: sudo ethtool -s eth2 speed 500

但我收到错误消息:

无法宣传速度 500

我尝试添加双工半双工全autoneg关闭autoneg 0n

我仍然收到此消息,但找不到此问题的原因,知道吗?

注意我在 ubuntu 机器上,我的 eth2 最初是 1G 。

小智 6

ethtool 不能用作 NIC 的带宽限制器,该参数仅设置将被宣传为能够达到的 NIC 速度,并且您不能在该参数上设置任意值并期望它起作用。它需要一个非常具体的可能值列表中的一个(或组合),这些值与双工模式设置相关。从 ethtool 的手册页:

advertise N
              Sets  the  speed  and duplex advertised by autonegotiation. The
              argument is a hexidecimal value using one or a combination of
              the following values:
              0x001    10 Half
              0x002    10 Full
              0x004    100 Half
              0x008    100 Full
              0x010    1000 Half(not supported by IEEE standards)
              0x020    1000 Full
              0x8000   2500 Full(not supported by IEEE standards)
              0x1000   10000 Full
              0x03F    Auto
Run Code Online (Sandbox Code Playgroud)

  • 此外:您通常无法更改虚拟机中半虚拟化 NIC 的速度和双工设置。 (2认同)