I'm running sshdroid server on my android device at port 22 and I get this while I use my pc to connect to it via ssh (LAN)

root@kali:~# ssh -l root
The authenticity of host ' (' can't be established. 
RSA key fingerprint is xxxxxxxxxxxxxxxxxxxx­xxxxxxxxxxxxxxxxxx
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
Use 'root' as username
Default password is 'admin'
root@­'s password: 
root@android:/data/­data/­berserker.android.app­s.sshdroid/home #

now when I try to access it via ssh (INTERNET)

root@kali:~# ssh -l root x.xx.xx.xxx
ssh: connect to host x.xx.xx.xxx port 22: No route to host 

so I tried to scan the ports in my external via nmap and got this as output..

root@kali:~# nmap x.xx.xx.xxx
Starting Nmap 6.47 (http://nmap.org/) at 2015-09-29 16:30 IST
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn 
Nmap done: 1 IP address (0 hosts up) scanned in 3.13 seconds 
root@kali:~# nmap -Pn x.xx.xx.xxx

Starting Nmap 6.47 (http://nmap.org/) at 2015-09-29 16:30 IST

Nmap scan report for x.xx.xx.xxx
Host is up (0.11s latency).
All 1000 scanned ports on 1-39-60-154.live.vod­afone.in (x.xx.xx.xxx) are filtered
Nmap done: 1 IP address (1 host up) scanned in 5.77 seconds 


I'm using DIR-600M router. How can I connect to my device via ssh over internet?

  • Do you use a firewall ? – Vinz Sep 29 '15 at 11:52
  • I disabled it since it would block the connection – Joe_Vj _95 Sep 29 '15 at 11:54
  • Are you sure that your device has real IP address, not behind NAT? "No route to host" kind of suggests your IP is not good. – alamar Sep 29 '15 at 12:00
  • Is x.xx.xx.xxx the address of your dlink, your android device, or something else? – Mark Plotnick Sep 29 '15 at 12:07
  • its my external ip of the router – Joe_Vj _95 Sep 29 '15 at 12:25

As @Archemar said, you must forward port 22 to one of your machines. The router can't assume you want a port forwarded, even if only one machine stands behind the router. The default is to block everything, which is wise from a security perspective.

AFAIK, this means

  • Assigning one static local IP to each machine you want a port forwarded to. If you use DHCP, you'll be doing this in the router configuration interface by attributing an IP to the machine's MAC address (that is, to its network interface MAC address).

  • Forwarding port 22 to the static IP of your choice.

You didn't ask, but if you want to ssh to several machines on your local network, you can do so by using non-standard ports, one for each machine.

  • i have a doubt.i use my another android mobile to tether internet over usbto my pc. the pc is connected to the DIR-600M router (nota modem).when i connect to internet i was assigned an ip address.is this ip address the external ip address of the router too?or this is the main cause for all the problems i have? – Joe_Vj _95 Sep 29 '15 at 14:49
  • I'm not sure I understand your setup, but it seems uncommon. You may want to edit your question and add a precise description of it. – Jérôme Sep 29 '15 at 15:01

There is probably multiple host behind your router (for instance you android).

The router has no way of knowing where to send incomming ssh packet (*), or if you accept them at all.

You have to tell your router what to do (to which IP send) incomming packet you accept.

This is often called port forwarding on web page of router setting.


ssh (port 22) ->
web (port 80&443) ->
Foo (port 12345, 666, 1756) ->

(*) a common objection is:

But can't my router scan local IPs for open 22 port and update port forwarding ?

No, as told above, the router can't guess if you are willing to accept incomming connection (to put alone time spent to scan your open port).

  • At a single point of time i will use either my android or my pc . Not both . In such case how shall the router get confused? – Joe_Vj _95 Sep 29 '15 at 12:08
  • Port 22 is open – Joe_Vj _95 Sep 29 '15 at 12:15
  • @Joe_Vj_95 are you sure that your router isn't using ssh (tcp/22) itself, rather than forwarding it on? Some routers do that by default. Cisco Linksys RV042 and Draytek Vigor routers, for example. – roaima Sep 29 '15 at 12:26
  • im not sure because im new to networking . how can i check it @roaima – Joe_Vj _95 Sep 29 '15 at 12:27
  • @Joe_Vj_95 you need to log in to your Router and look at the Maintenance / Administration page. – roaima Sep 29 '15 at 14:11

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.