Remove SOME advertised link modes with ethtool

9,032

The thing with autonegotiation is that if you turn it off from one end, the other side can detect the speed but not the duplex mode, which defaults to half. Then you get a duplex mismatch, which is almost the same as the link not working. So if you disable autonegotiation on one end, you practically have to disable it on the other end too.

(Then there's the thing that autonegotiation doesn't actually test the cable, just what the endpoints can do. This can result in a gigabit link over a cable that only has two pairs, and cannot support 1000Base-T.)

But ethtool seems capable of telling the driver what speed/duplex modes to advertise. ethtool -s eth1 advertise 0x0f would allow all 10/100 modes but not 1G.

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
      0x010       1000baseT Half       (not supported by IEEE standards)
      0x020       1000baseT Full
Share:
9,032

Related videos on Youtube

SOKS
Author by

SOKS

Updated on September 18, 2022

Comments

  • SOKS
    SOKS almost 2 years

    I'm in a situation where I have a 10/100/1000-capable PHY cabled only to support 10/100.

    The default behaviour is to use the autonegociation to find the best mode. At the other end, using a gigabit capable router ends in a non-working interface. I guess autonegociation never converges. I've heard some people tried with a 100Mbps switch and it works fine.

    I'm able to get it working using ethtool but this is quite frustrating :

    ethtool -s eth1 duplex full speed 100 autoneg off

    What I'd like to do is to keep the autonegociation but withdraw 1000baseT/Full from the choices so that it ends up running seemlessly in 100Mbps. Any way to achieve that using ethtool or kernel options ? (didn't find a thing on my 2.6.32 kernel ...)

    (Let's just say some strange dude comes to me with a 10Mbps switch, I need this eth to work with this switch from another century)

  • SOKS
    SOKS over 6 years
    Exactly why I want autonegociation on ! Although the internals are a mystery to me (and many of us) it's a pretty useful mechanism. What you wrote is the exact answer I was looking for. THANKS
  • ilkkachu
    ilkkachu over 6 years
    I was also happy to find that it worked properly... after I accidentally tested it on a live NIC, instead of the spare one (rolleyes).
  • Seamus
    Seamus almost 6 years
    Brilliant!! I think I had a mental block specifying the value for advertise. I just could not connect "combination" to hex addition. When I saw your 0x0f, it hit me like a head slap :) Danke!