8

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

sudo scp /etc/corosync/authkey  [email protected]:~

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.

15
  • Can you ping your desktop from your laptop?
    – Philippos
    Jun 4, 2019 at 6:53
  • I can ping it,works OK. Jun 4, 2019 at 6:56
  • 3
    Time to live exceed means there are routing loops Jun 4, 2019 at 7:42
  • 4
    Somewhere in this you have a typo in your question or at the command line... Both your desktop and laptop have are on a /24 subnet 192.168.0.x but you are trying to connect to 192.168.2.x. Is this a typo in your question or are you actually making this same mistake at the command line? Jun 4, 2019 at 9:02
  • 3
    @RuiFRibeiro being a pedant I'd say that Time to live exceed means that a packet has been passed through a router too many times. This almost exclusively is caused by a routing loop. But only almost. :-) Jun 4, 2019 at 9:18

2 Answers 2

4

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
2
  • How to check iptables allowing ssh port? Jun 4, 2019 at 9:37
  • check systemd <systemctl status ssh> then check iptables running <systemctl status iptables> also <iptables -L> if you are using Ubuntu, the firewall is ufw, then ufw status
    – tien
    Jun 4, 2019 at 10:14
2

Check whether sshd service is running or not. systemctl status sshd

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .