This seems to be a rare problem for most people, and in fact should be, however, if you’ve ever had bad CAT (5/5e/6/whatever) cables [because you made them yourself maybe], then theres a possibility you’ve come across a strange scenario where your NIC cannot access the network (or establish a good connection with your Switch/Hub or Router) and forcibly setting it down to 10Mbps is the only way to get it to work.
So, if you have the same problem, there’s a ridiculously easy solution in Linux. Years ago, we had to use mii-tool. mii-tool, however, is now deprecated and could only handle 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD or 10baseT-HD.
Here comes in our hero of the day namely ethtool.
Now, I was at my ranch where I did all of the wiring for the network cables. That included the RJ-45 wall jackets, as well as the plastic connectors for the basement where all of the cables eventually lead down to multiple / separate switches and routers (yes, multiple routers, mini-networks, pain in the ass – i know)
Well there’s one room thats always caused problems from the get-go. At first I thought it was the socket, then I thought it was the plastic connector. I’ve changed both many times, different computers would work, some would not, sometimes it’d work when I would boot with one OS, often it wouldn’t with another.
Finally, I figured out that the pattern had to do with whether or not the NIC was set to 10Mbps, as opposed to 100Mbps or 1000Mbps/1Gbps. Then it hit me, the cable must have be damaged IN SIDE the wall somewhere or in the floor.. either way way I have to make sure that the NIC is downgraded to 10Mbps and everyone works fairly well afterwards.
So, here’s the magical command everyone insisted on me using:
ethtool -s eth0 speed 10 duplex full autoneg on
Sadly, this command would not work!
First things first, I am using the RTL6169 driver for my RTL6168/6111b NIC – it doesn’t support being told to renegotiate, I realized, so then I thought I would follow up with these commands:
ethtool -s eth0 speed 10 duplex full
ethtool -r eth0
…to manually re-negotiate after setting the speed. However, I found that the first step would not even work. Basically, in no way could I get ethtool to downgrade or change the speed setting. It just refuses to do make it change at all.
This means I had to go back and use the so-called “deprecated” mii-tools. On Ubuntu 11.04 I was able to install it using the net-tools package. Alternatively you can download the source to mii-tools (its a very harmless easy compile / install with the make command).
So I fired up the good ‘ol tool using this exact command:
mii-tool -F 10baseT-FD eth0
Voila! Presto! Banzai! It works! It.. just.. works.. ethtool could not work or ethtool would not work, but mii-tool worked just fine.
Obviously, I did not want to run the command every time I rebooted, so I edited the file /etc/network/interfaces and added this line at the bottom:
pre-up /sbin/mii-tool -F 10baseT-FD eth0
Some people recommend making a script or running it from rc.d or init.d, etc. That’s just bad system administration, IMHO. There is no better place than the interfaces file, its there (and the use of the pre-up command) for a reason just like this one for startup NIC operations.
So the moral of the story? Just because a tool is old does not mean its usefulness has waned!