SSH Error – SSH No Route to Host

networkingscpssh

I am trying to copy my Corosync key from my desktop to my laptop.

sudo scp /etc/corosync/authkey  mm-HP-Elit@192.168.0.10:~

What I got is this

ssh: connect to host 192.168.0.10 port 22: No route to host
lost connection

Both of them use the same router in my house.

From my desktop, I am pinging laptop

ping 192.168.0.10
PING 192.168.0.10 (192.168.0.10) 56(84) bytes of data.
64 bytes from 192.168.0.10: icmp_seq=1 ttl=64 time=1.29 ms
64 bytes from 192.168.0.10: icmp_seq=2 ttl=64 time=1.08 ms
64 bytes from 192.168.0.10: icmp_seq=3 ttl=64 time=1.03 ms
64 bytes from 192.168.0.10: icmp_seq=4 ttl=64 time=1.05 ms
^C
--- 192.168.0.10 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 1.039/1.118/1.298/0.110 ms

    4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3004ms

Telenet is refused

telnet 192.168.0.10 22
Trying 192.168.0.10...
telnet: Unable to connect to remote host: Connection refused

My desktop IP

inet 192.168.0.12/24 brd 192.168.0.255 scope global dynamic noprefixroute enp3s0

My laptop IP

inet 192.168.0.10/24 brd 192.168.0.255 scope global dynamic noprefixroute wlo1

My idea was to open port 22.
Netstat output

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:902             0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:38183           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:55181           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:38767         0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:2224            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:8307          0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:57721           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:17500           0.0.0.0:*               LISTEN      3340/dropbox        
tcp        0      0 127.0.0.1:17600         0.0.0.0:*               LISTEN      3340/dropbox        
tcp        0      0 0.0.0.0:5473            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:17603         0.0.0.0:*               LISTEN      3340/dropbox        
tcp        0      0 0.0.0.0:37795           0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::902                  :::*                    LISTEN      -                   
tcp6       0      0 :::48647                :::*                    LISTEN      -                   
tcp6       0      0 :::111                  :::*                    LISTEN      -                   
tcp6       0      0 :::2224                 :::*                    LISTEN      -                   
tcp6       0      0 :::80                   :::*                    LISTEN      -                   
tcp6       0      0 :::39283                :::*                    LISTEN      -                   
tcp6       0      0 :::51607                :::*                    LISTEN      -                   
tcp6       0      0 ::1:631                 :::*                    LISTEN      -                   
tcp6       0      0 :::443                  :::*                    LISTEN      -                   
tcp6       0      0 :::35835                :::*                    LISTEN      -                   
tcp6       0      0 :::17500                :::*                    LISTEN      3340/dropbox        
tcp6       0      0 :::2049                 :::*                    LISTEN      - 

I tried again to open 22

sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT

but still I do not see 22 with netstat

netstat -tpln | grep 22
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:2224            0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::2224                 :::*                    LISTEN      -  

How to resolve this problem?

SOLVED
It was an sshd issue. I purged and installed OpenSSH server.

Best Answer

I don't see SSH port on your netstat result.

Desktop IP: 192.168.0.12

Laptop IP: 192.168.0.10

  1. Need to make sure desktop can ping laptop

    ping 192.168.0.10
    
  2. If ping succeeds, then telnet to ensure SSH port is available and allowable.  (Default SSH port is 22; I don't know whether you changed it on your system.)

    telnet 192.168.0.10 22
    

Telnet OK --> you can run scp command.

Telnet Not OK --> recheck the SSH service running.

How to check SSH service running?

  • check systemd
  • check iptables (or ufw) allowing SSH port.
  • netstat -tapln | grep 22
Related Question