If you get following errors from an active ssh connection:
Bad packet length 0.
Disconnecting: Packet corrupt
it is related with packet corruption in MAC level.
Your network card may be buggy or you may have cable issues but most probably if you disable the hardware checksum offloading on the network interface it will start to work again.
Please note that, it is hard to reproduce the “Packet corrupt” error in ssh but if you try to get big TCP packets like running dmesg
command or lsof -n
, you may reproduce the problem easily.
In order to disable hardware checksum offload on an interface you can use ethtool
like below:
$ sudo ethtool -K eth0 tx off rx off
If you want to run ethtool automatically on next boot, you can write an up hook in /etc/network/interfaces
file on Debian based systems like that:
iface eth0 inet static
...
up /sbin/ethtool -K eth0 tx off rx off
You can learn more about segmentation and checksum offloading here: http://sandilands.info/sgordon/segmentation-offloading-with-wireshark-and-ethtool