1

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:137.44.181.163  Bcast:137.44.183.255  Mask:255.255.252.0
          inet6 addr: fe80::62d8:19ff:fe24:bd8b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1450  Metric:1
          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 137.44.181.163 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 137.44.181.163 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.

1
  • 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, 2021 at 11:17

1 Answer 1

0

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                                                                                                       
0.0.0.0         10.64.1.1     0.0.0.0         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 0.0.0.0 and subnet mask of 0.0.0.0 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.

2
  • 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, 2015 at 9:26
  • @brucezepplin: You'd have bring this up to someone that has root access on that server then.
    – Larssend
    Jul 20, 2015 at 9:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .