On Debugging Raspberri Pi SSH

Posted on Aug 12, 2020

I was facing connection dropouts with my Raspberry Pi 4 when I was using ssh to connect to it. I thought initially it was an ssh connection issue which lead me to this blogpost: https://alignan.github.io/post/raspberry-pi-ssh-hangs/

Tl;DR: add “IPQoS 0x00” to the bottom of the “/etc/ssh/ssh_config” and “/etc/ssh/sshd_config” files

The problem with the ssh connection dropping persisted, so I was cycling the power a few times to see if a reboot resolved the problem. As the power was cycling I began pinging the ip address to see when it was back up. I left ping running by accident, but when I came back to it I noticed this pattern.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
$ ping 10.1.1.111
PING 10.1.1.111 (10.1.1.111): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
Request timeout for icmp_seq 8
Request timeout for icmp_seq 9
Request timeout for icmp_seq 10
Request timeout for icmp_seq 11
Request timeout for icmp_seq 12
Request timeout for icmp_seq 13
Request timeout for icmp_seq 14
Request timeout for icmp_seq 15
Request timeout for icmp_seq 16
Request timeout for icmp_seq 17
64 bytes from 10.1.1.111: icmp_seq=18 ttl=64 time=50.765 ms
64 bytes from 10.1.1.111: icmp_seq=19 ttl=64 time=17.091 ms
64 bytes from 10.1.1.111: icmp_seq=20 ttl=64 time=4.455 ms
64 bytes from 10.1.1.111: icmp_seq=21 ttl=64 time=2.985 ms
64 bytes from 10.1.1.111: icmp_seq=22 ttl=64 time=6.671 ms
64 bytes from 10.1.1.111: icmp_seq=23 ttl=64 time=2.410 ms
64 bytes from 10.1.1.111: icmp_seq=24 ttl=64 time=2.194 ms
64 bytes from 10.1.1.111: icmp_seq=25 ttl=64 time=6.704 ms
64 bytes from 10.1.1.111: icmp_seq=26 ttl=64 time=2.406 ms
64 bytes from 10.1.1.111: icmp_seq=27 ttl=64 time=4.612 ms
64 bytes from 10.1.1.111: icmp_seq=28 ttl=64 time=11.407 ms
64 bytes from 10.1.1.111: icmp_seq=29 ttl=64 time=2.234 ms
64 bytes from 10.1.1.111: icmp_seq=30 ttl=64 time=6.462 ms
64 bytes from 10.1.1.111: icmp_seq=31 ttl=64 time=6.671 ms
64 bytes from 10.1.1.111: icmp_seq=32 ttl=64 time=18.055 ms
64 bytes from 10.1.1.111: icmp_seq=33 ttl=64 time=3.473 ms
64 bytes from 10.1.1.111: icmp_seq=34 ttl=64 time=5.266 ms
64 bytes from 10.1.1.111: icmp_seq=35 ttl=64 time=17.790 ms
64 bytes from 10.1.1.111: icmp_seq=36 ttl=64 time=2.376 ms
64 bytes from 10.1.1.111: icmp_seq=37 ttl=64 time=2.982 ms
64 bytes from 10.1.1.111: icmp_seq=38 ttl=64 time=6.646 ms
64 bytes from 10.1.1.111: icmp_seq=39 ttl=64 time=20.087 ms
Request timeout for icmp_seq 40
Request timeout for icmp_seq 41
Request timeout for icmp_seq 42
Request timeout for icmp_seq 43
Request timeout for icmp_seq 44
Request timeout for icmp_seq 45
Request timeout for icmp_seq 46
Request timeout for icmp_seq 47
Request timeout for icmp_seq 48
Request timeout for icmp_seq 49
Request timeout for icmp_seq 50
Request timeout for icmp_seq 51
Request timeout for icmp_seq 52
Request timeout for icmp_seq 53
Request timeout for icmp_seq 54
Request timeout for icmp_seq 55
Request timeout for icmp_seq 56
Request timeout for icmp_seq 57
Request timeout for icmp_seq 58
Request timeout for icmp_seq 59
Request timeout for icmp_seq 60
Request timeout for icmp_seq 61
Request timeout for icmp_seq 62
Request timeout for icmp_seq 63
Request timeout for icmp_seq 64
Request timeout for icmp_seq 65
Request timeout for icmp_seq 66
Request timeout for icmp_seq 67
Request timeout for icmp_seq 68
Request timeout for icmp_seq 69
Request timeout for icmp_seq 70
Request timeout for icmp_seq 71
Request timeout for icmp_seq 72
Request timeout for icmp_seq 73
Request timeout for icmp_seq 74
Request timeout for icmp_seq 75
Request timeout for icmp_seq 76
Request timeout for icmp_seq 77
Request timeout for icmp_seq 78
64 bytes from 10.1.1.111: icmp_seq=79 ttl=64 time=24.544 ms
64 bytes from 10.1.1.111: icmp_seq=80 ttl=64 time=14.023 ms
64 bytes from 10.1.1.111: icmp_seq=81 ttl=64 time=12.715 ms
64 bytes from 10.1.1.111: icmp_seq=82 ttl=64 time=2.710 ms
64 bytes from 10.1.1.111: icmp_seq=83 ttl=64 time=5.815 ms
64 bytes from 10.1.1.111: icmp_seq=84 ttl=64 time=28.147 ms
64 bytes from 10.1.1.111: icmp_seq=85 ttl=64 time=17.126 ms
64 bytes from 10.1.1.111: icmp_seq=86 ttl=64 time=10.809 ms
64 bytes from 10.1.1.111: icmp_seq=87 ttl=64 time=4.791 ms
64 bytes from 10.1.1.111: icmp_seq=88 ttl=64 time=7.696 ms
64 bytes from 10.1.1.111: icmp_seq=89 ttl=64 time=5.170 ms
64 bytes from 10.1.1.111: icmp_seq=90 ttl=64 time=5.606 ms
Request timeout for icmp_seq 91
Request timeout for icmp_seq 92
Request timeout for icmp_seq 93
Request timeout for icmp_seq 94
Request timeout for icmp_seq 95
Request timeout for icmp_seq 96
Request timeout for icmp_seq 97
Request timeout for icmp_seq 98
Request timeout for icmp_seq 99
Request timeout for icmp_seq 100
Request timeout for icmp_seq 101
Request timeout for icmp_seq 102

It turns out the problem was not the ssh connection at all, or at least not specifically, but that the internet connection was unstable. I switched to a 5Ghz connection instead of 2.4Ghz and the connection problem was resolved! It is an avenue worth investigating if you are having issues with ssh over your local network.