In brief, sometimes a conflict occurs between some firewalls and the TCP SACK. In my case, the upload was severely affected and reached upload speeds of a few kilobytes over a LAN!
The following command disables TCP SACK and fixes the slow upload on all Ethernet cards:
sudo sysctl -w net.ipv4.tcp_sack=0
To make it permanent, edit /etc/sysctl.conf and add this line
net.ipv4.tcp_sack = 0
Then run:
sudo sysctl -p
Enjoy the ultra super duper fast uploads! I can now upload at above 40 MB/sec!
Sources:
- http://kb.pert.geant.net/PERTKB/SelectiveAcknowledgements
- http://linuxsecure.blogspot.qa/2008/05/scp-stalled-through-firewall-ssh-no.html
- https://stackoverflow.com/questions/11985008/sending-a-large-file-with-scp-to-a-certain-server-stalls-at-exactly-2112-kb
- https://www.cyberciti.biz/faq/making-changes-to-proc-filesystem-permanently/