I was trying to SSH into a machine from my Kali Linux VM shortly after updating packages and encountered this error immediately after authenticating:
packet_write_wait: Connection to X.X.X.X port 22: Broken pipe
I was using VMWare Workstation. SSH on my host was working as expected. Another VM in VirtualBox was working just fine, too. Another VM running an ancient Linux distribution within VMWare was also working just fine. Running my SSH client in verbose mode didn’t yield anything of use for troubleshooting the problem. HMMM…
The affected OpenSSH version was 7.9p1. OpenSSH 7.5p1 was working just fine. After a bit of Googling, I found a solution:
https://communities.vmware.com/thread/590825
ssh -o 'IPQoS=lowdelay throughput' user@host
I ended up adding the option to my ~/.ssh/config as a workaround:
Host * IPQoS=lowdelay throughput
Apparently, VMWare’s NAT implementation is broken: