I am running Lubuntu 14.04 and have set up an SSH server. It has taken me ages to troubleshoot because of a confusing fact.
At home I can SSH my laptop from itself using either my local IP address (192.168.0.x
) or my public IP address (router port forwarding set up properly).
If I take my laptop, as is, to my friend, I can only SSH myself using my local IP address but not using my friend's public IP address. Aha, you think, it is because port forwarding is not set up properly in his router. Well, this is the confusion: it is set up properly, as far as I can tell. Namely, I can indeed SSH my laptop from a computer outside his network using my friend's public IP address. Using the public IP address from within his network causes the login to stall.
If I do, from within his network,
ssh -v *public_IP_addess*
the last two lines to be output before it stalls are
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
whereas doing the same command from outside his network is successful, and the couple of lines following the lines above are
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 pat OpenSSH_6.6.1* compat 0x04000000
...
How can this behaviour be explained? Why can I use my public IP address when I am at home but not at my friend's place?