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

4

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

$ scp filename.file username@10.0.0.109:/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

Posted 2015-08-06T03:49:20.677

Reputation: 173

$ 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 – 2015-08-06T05:02:08.407

The above are the ip route result, arp -an and iptables -L those two commands are not found on my Debian Linux. – GoingMyWay – 2015-08-06T05:04:08.403

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 – 2015-08-06T07:28:45.940

Did you try disabling one of the interfaces? – Paul – 2015-08-06T08:08:04.327

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 – 2015-08-06T08:20:36.390

$ 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. – GoingMyWay – 2015-08-06T08:30:37.563

Answers

8

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

Laith Leo Alobaidy

Posted 2015-08-06T03:49:20.677

Reputation: 126

0

It can be problem if you had not added your client ip address into your /etc/hosts file . It can be done by just adding your client ip like these one,

127.0.0.1   localhost
192.168.1.32 master
192.168.56.133 slave

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Now after that your ssh yourclientname should run

Shubham Sharma

Posted 2015-08-06T03:49:20.677

Reputation: 101