I would like to ssh into my local machine, from a remote ssh shell. by looking at ifconfig

$ ifconfig

wlan0     Link encap:Ethernet  HWaddr 60:d8:19:24:bd:8b  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::62d8:19ff:fe24:bd8b/64 Scope:Link
          RX packets:2107490 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1813977 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2109347830 (2.1 GB)  TX bytes:340765253 (340.7 MB)

I can do ssh from my local machine just fine. However when I try this from the remote machine (yes I do actually want to do this rather than just exit the shell) I get:

 ssh: connect to host port 22: No route to host

port 22 is open.

/etc/sysconfig/iptables did not exist on local machine so I created it and added:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

just to be sure. still nothing.

Perhaps my entire approach is wrong - but I wondered if anyone had any adivce on how I can ssh back into my local machine, from a remote host? I need to do this for file/folder transfer purposes. I do not want to come out of remote host and use scp as I need to push the file from the remote host, rather than retrieve it while on local host.

  • The fact that the IP address is a public one makes this suspicious, although it's possible that the AP is directly attached to the ISP LAN.
    – Tom Yan
    Apr 20 at 11:17

The error message says it all: your host does not know how to get to the destination, because the destination host's IP address or network address is not on your routing table.

Enter netstat -rn. You should see something like:

Destination     Gateway       Genmask         Flags   MSS Window  irtt Iface                                                                                                       UG        0 0          0 wlan1

The IP address in the Gateway column should be that of your router's. This kind of entry with a destination IP address of and subnet mask of is called a default gateway or default route.

If your routing table does not have a default route, you should add one. A non-persistent solution would be to enter route add default gw [router_ip] in the terminal as root. You will have to change your host's static IP configuration or your router's DHCP server parameters for a permanent solution.

  • hi Larssed - on my local machine I can see that I have my IP address in the gateway column - but not on the remote server. I do not have root access on remote server, so I don't see how I could add my local ip address using the method you have set out? Jul 20 '15 at 9:26
  • @brucezepplin: You'd have bring this up to someone that has root access on that server then.
    – Larssend
    Jul 20 '15 at 9:28

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.