I've searched solution in Google for 3 days, when I decided to write here. I have a router, so in my house is WLAN. I use laptop when I stay at home. In another city in my office I have a second computer (PC). I can connect with this PC using SSH protocol. Unfortunately I can't connect with my laptop from PC. When I try to do this, I see the statement:
ssh: connect to host XX.XX.XX.XX port 22: Network is unreachable
Daemon SSHD is running in my laptop. What is interesting, this connection worked correctly a few months ago, but I reinstalled the SSHD and now is the problem.
/sbin/route shows:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.9.1 0.0.0.0 UG 0 0 0 wlan0
192.168.9.0 * 255.255.255.0 U 2 0 0 wlan0
/sbin/ifconfig prints:
eth0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:47
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:169 errors:0 dropped:0 overruns:0 frame:0
TX packets:169 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:13189 (12.8 Kb) TX bytes:13189 (12.8 Kb)
wlan0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
inet addr:192.168.9.107 Bcast:192.168.9.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:76455 errors:0 dropped:0 overruns:0 frame:0
TX packets:82766 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:53583517 (51.1 Mb) TX bytes:13182981 (12.5 Mb)
I suppose, that the problem is related with settings of gateway, but I'm layman in this subject (Computer Network). This suggestion is due to my Google's investigation.
Best Answer
Since you have not provided additional information, I will elaborate on my comment as to what I think is happening here.
Just to preface this, please forgive me for assuming you have made this mistake, I'm just going on what you're saying:
I believe that you are trying to use your home computer's private IP address when trying to SSH into it from work. This would produce one of two behaviors depending on the network configuration at your home and workplace:
Then why did it work before?
My guess is, this happened at a time you had brought your laptop to work, in which case, both devices were on the same private network. When you reported it "working" you were thinking that the issue has to do with your SSH daemon rather than with your network configuration.
So how can I work around this?
There are several solutions. Here are some that I can think of:
Note that in both solutions 2 and 3 above, you'll need some mechanism to forward the SSH port that your laptop listens on (this is port 22 by default) from your gateway router (where the connection will come) to your laptop. This can often be accomplished from within the router itself. In your router's interface, look at NAT (network address translation) options. In some routers, this may be filed under a "Gaming" category.
1 Of course that office machine may or may not have an SSH daemon running. So you'll either be asked to provide credentials for the user you're trying to log in as (the odds of those being the same as your laptop's credentials are also slim) or you'll get a "Connection refused" error since there is no SSH listener running (on the standard SSH port) of that device.
2 Your device having a static IP makes it a stationary target for attackers, so you might want to think about firewalling and tight access control in that case.