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

$ scp filename.file username@
ssh: connect to host 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
PING ( 56(84) bytes of data.
From icmp_seq=1 Destination Host Unreachable
From icmp_seq=2 Destination Host Unreachable
From icmp_seq=3 Destination Host Unreachable
From icmp_seq=4 Destination Host Unreachable
From icmp_seq=5 Destination Host Unreachable
From icmp_seq=6 Destination Host Unreachable
From icmp_seq=7 Destination Host Unreachable
From icmp_seq=8 Destination Host Unreachable
From icmp_seq=9 Destination Host Unreachable

Routing table:

$ ip route 
default via dev wlan0 proto static dev eth0 proto kernel scope link src dev wlan0 proto kernel scope link src dev eth0 scope link metric 1000 

arp -an

root@debian:# arp  -an
? ( 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?

  • So you are saying, from that same machine where you are trying to do scp, you can do ssh username@ & it works? – neuron Aug 6 '15 at 7:08
  • There is a difference between LAN and WAN, if your colleague host is "behind" a routeur, there are step to be done (namely forwarding port) before you can access hosts. You will be using his WAN IP of course. Can you give more details about network topology ? – Archemar Aug 6 '15 at 7:21
  • Hi, I have update the problem in detail. – GoingMyWay Aug 6 '15 at 7:47
  • $ssh jeff@ ssh: connect to host port 22: No route to host I mean, if I scp and ssh a mahine that out of the LAN where my machine in, it works well. – GoingMyWay Aug 6 '15 at 7:52
  • Try to ping your colleague's machine from yours, and viceversa. Post the results. – dr01 Aug 6 '15 at 8:04

What I need to disable eth0, after that, it works fine!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.