How to troubleshoot a slow network with Linux

solving network problems with Linux

Solving network problems with Linux

Where to start from to solve network problems?
I believe that most of the times they are related to software issues, however I found myself suddenly with a slow network and it was caused by an hardware problem. I’ll give a description of what happened and how I solved it.

The network problem

I used to use rsync to do my backups, and one day rsync said that it wasn’t receiving data from the remote host. I don’t remember the exact error message.

To debug and isolate the problem I used iperf, an application that measures the connectivity speed. You have to run an instance on the server and an instance on the client. It sees how much fast your network is.

Iperf reported that the actual speed of my network was quite below its nominal value, 100Mbps. I was obtaining only 80kbps.

All had happened after buying a new computer, so I thought the problem was related to its network card, so I began investigating.

The investigation

I launched the network card diagnostic of the HP Z240 workstation I bought from the UEFI bios, and it gave an error result more than one time.

However, the problem wasn’t there, and at least I discovered it before contacting the assitance.

Thinking however that the problem was hardware related, network card related, I luanched the ifconfig command. I saw that the errors field wasn’t reporting zero as it should, and the errors grew with the network traffic going on.

To better understand from where the errors were going from, I launched the ethtool this way

where eno1 is the network card (I was used to know it as eth0, this is a new name I saw under Linux Ubuntu 16.04 LTS).

I could verify with ethtool that the errors were all CRC errors, as the field rx_crc_errors wasn’t zero.

I used a crossed cable to transmit data between the two computers I own, and the result was good, the real network speed was almost the nominal one (100Mbps). So the problem was related to the router or to the other cables.

What I tried

I tried to replace the cables with new ones, thinking the contacts could be oxydized. However nothing changed, so I identified the real responsible: the router.

The solution

Luckily  I thought of lowering the network speed of the network cards, from 100Mbps to 10Mbps. All returned to work well.

I forced a lower network speed with the following command, placed inside the /etc/rc.local file of my Ubuntu.

It is possible to set a lower speed from Windows 10 too.

For some reason, the ISO/OSI level 2 section of my router is not working well anymore, and only a speed of 10 megabits is supported well.

I have to replace the router, however in the meantime it is better to have a lower speed that works well that a 100Mbit network that works at near zero speeds.

ethtool to debug network problems under Linux

In the process of solving the nework problems, I found this page useful

The italian version of this article is here