Why is it that to establish an SSH connection, I need to open a local terminal and run any valid command?

I have two laptops, say A and B. I have an SSD, an external disk, with a perfectly working Debian 13 installed and connected to a USB input of laptop B. Laptop B is connected via Wi-Fi to an ADSL Modem-Router; Laptop A is also connected to this router using two “Live Plugs”: Router > Ethernet connection > powerline connections > Ethernet connection> Laptop A.

For the past few days, every time I try to connect to this SSD via SSH, I have to open a local terminal and run any valid command on it. If I don’t do this, especially if the command I’m running on the local terminal is invalid, “command not found”, the connection fails with the error “no route to host.”

Once I’ve done this, I can close the SSH connection and reopen it as needed: no further issues untill I either reboot this SSD or wake it up from sleep after a suspend action (“suspend on lid close”).

If this helps, once the SSH connection was established, I ran the following commands from a terminal on the SSD:

    ~$ ss -tunlp
Netid   State    Recv-Q   Send-Q                          Local Address:Port                       Peer Address:Port                  Process                   
.........                          
tcp     LISTEN   0        128                                   0.0.0.0:22                              0.0.0.0:*                                               
tcp     LISTEN   0        4096                                    [::1]:631                                [::]:*                                               
tcp     LISTEN   0        128                                      [::]:22                                 [::]:*  

    ~$ systemctl status systemd-networkd
○ systemd-networkd.service - Network Configuration
     Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; disabled; preset: enabled)
     Active: inactive (dead)
.........

    ~$ systemctl status NetworkManager
● NetworkManager.service - Network Manager
     Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; preset: enabled)
     Active: active (running) since Tue 2026-05-12 01:07:38 EDT; 2h 3min ago
 ........

Do you have any idea what’s going on?

PS: Actually, it’s a little more complicated than I thought. After a few more attempts, including shutting down and restarting the system, the SSH connection seemed to be working again, but then, after a few more tries, it started acting up again. So it’s a
random issue. That doesn’t make things any easier.