scp ssh: connect to host 10.0.0.109 port 22: No route to host lost connection

56,117

Check the firewall (iptables) on 10.0.0.109 server.

Make sure its allowing SSH connection to it.

iptables -I INPUT -p TCP -s YOUR_CLIENT_IP -j ACCEPT
Share:
56,117

Related videos on Youtube

GoingMyWay
Author by

GoingMyWay

A Self-Learner!

Updated on September 18, 2022

Comments

  • GoingMyWay
    GoingMyWay over 1 year

    I use SCP command on Linux Debian to transfer a file to my colleague via LAN. But I encounter the problem:

    $ scp filename.file [email protected]:/tmp
    ssh: connect to host 10.0.0.109 port 22: No route to host
    lost connection
    

    But when I use the same command to transfer the file to a WAN machine, it works well. And when I use ping to ping WAN website, it works well, but when I ping a LAN ip address, it does not work.

    $ ping 10.0.0.1
    PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
    From 10.0.0.108 icmp_seq=1 Destination Host Unreachable
    From 10.0.0.108 icmp_seq=2 Destination Host Unreachable
    From 10.0.0.108 icmp_seq=3 Destination Host Unreachable
    From 10.0.0.108 icmp_seq=4 Destination Host Unreachable
    From 10.0.0.108 icmp_seq=5 Destination Host Unreachable
    From 10.0.0.108 icmp_seq=6 Destination Host Unreachable
    From 10.0.0.108 icmp_seq=7 Destination Host Unreachable
    From 10.0.0.108 icmp_seq=8 Destination Host Unreachable
    From 10.0.0.108 icmp_seq=9 Destination Host Unreachable
    

    Routing table:

    $ ip route 
    default via 10.0.0.1 dev wlan0 proto static 
    10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.108 
    10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.108 
    169.254.0.0/16 dev eth0 scope link metric 1000 
    

    arp -an

    root@debian:# arp  -an
    ? (10.0.0.1) at c4:04:15:17:bd:66 [ether] on wlan0
    

    iptables -L

    root@debian:# iptables -L
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    

    I can explore the Internet via Firefox. It just can't connect the LAN machie.

    And my ip address is static ip in my company's LAN.

    The port 22 is open, and there seems nothing wrong with iptables and SSH works well too.

    How can I fix it?

    • GoingMyWay
      GoingMyWay almost 9 years
      $ ip route default via 10.0.0.1 dev wlan0 proto static 10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.108 10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.108 169.254.0.0/16 dev eth0 scope link metric 1000
    • GoingMyWay
      GoingMyWay almost 9 years
      The above are the ip route result, arp -an and iptables -L those two commands are not found on my Debian Linux.
    • Paul
      Paul almost 9 years
      You probably need to run sudo for the other two commands. Please can you disable either wireless or lan whilst doing this? You currently have two active network connections. Please edit your question to ad additional information.
    • Paul
      Paul almost 9 years
      Did you try disabling one of the interfaces?
    • GoingMyWay
      GoingMyWay almost 9 years
      I disabled eth0 by using the command # ifconfig eth0 inet down , and it can transfer file to my colleague. Thank you for your help ^_^
    • GoingMyWay
      GoingMyWay almost 9 years
      $ ip route default via 10.0.0.1 dev wlan0 proto static 10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.108 The eth0 is not on ip route list now.