3

I have recently set up a local machine and a laptop, using noip.com, so that I can access the local (host) machine, via my laptop whilst I'm away on a trip - see my previous question here

Everything worked fine - until I thought I would give the machine (and router) a cold reboot - before going away for a couple of months. After following all of the previous steps given to me in my previous questions, I find I can't login back to the server machine from my laptop.

Here are the salient facts:

  1. Host machine (to be logged into) has SSH service running
  2. Host machine has static IP address configured (same IP as I was using before)
  3. No-IP update client is running on the host machine
  4. I can SSH into host machine from my laptop, when I'm on the same LAN, by using the local IP address 192.168.x.x
  5. The registered NO-IP address has not expired (I only registered it a few days ago - and I double checked by logging into my account - it has any correct public facing IP address)
  6. Port forwarding has been set up on the router, with SSH running on the default port of 22.

[[UPDATE]]

$sudo ufw status
To     Action     From
22     Allow      Anywhere
22(v6) Allow      Anywhere (v6)

Fail2ban has been installed on the host machine and was working well with my previous setup. I have currently stopped the service, whilst I try to figure out what is going on.

SSH has been set up on the host machine with the following config:

  • Port 22
  • PermitRootLogin no
  • PubkeyAuthentication yes
  • PasswordAuthentication no

When I attempt to SSH remotely, using my registered hostname from no-ip, I get the following error (this used to work fine until yesterday):

ssh -v [email protected]
OpenSSH_6.9p1 Ubuntu-2ubuntu0.1, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to myhostname.ddns.net [80.189.109.195] port 22.
debug1: connect to address xxx.yyy.zzz.123 port 22: Connection refused
ssh: connect to host myhostname.ddns.net port 22: Connection refused

Can anyone see what may be going wrong?. I have a flight in a few hours time, and I desperately need to get this sorted out, so I can remotely access my local machine from my laptop.

3
  • It looks like the router is not allowing the ssh connection through, have you set up any port-forwarding or another way through the router?
    – Arronical
    Mar 29, 2016 at 9:37
  • What you describe certainly sounds like your port forwarding isn't working. Are you 100% sure you're pointing your router to the right internal IP? Also, please edit your question and show us the output of ssh -vvv [email protected], in case there's anything else there.
    – terdon
    Mar 29, 2016 at 10:26
  • @terdon. The output with -vvv is EXACTLY the same as that with -v Mar 29, 2016 at 10:28

1 Answer 1

2

A few things to check, in order of most likely IME,

  • Port forwarding. Unless your machine is directly accessible from the internet on 80.xxx.yyy.zzz, that's probably a router's address. You need to tell that router to forward traffic on Port 22 on to your computer. This is router-specific. The best single resource for this is PortForward.com.

    I see no mention of this here or on the previous question so this seems most likely.

  • Firewalls can allow traffic from some locations and not others. I don't know what you've set up in this regard but if you're using UFW, sudo ufw status should let you see any deny/allow patterns that affect that port.

  • /etc/ssh/sshd_config might be set up to only allow connections on a certain network. This isn't the default behaviour so again, this will have been something you've inadvertently done.

  • If you've installed fail2ban, is it possible you've already triggered one of its its automated bans from your external IP?


Before you push this onto the Internet using near-stock settings, I'd strongly suggest you read an article I wrote on making SSH secure. People get hacked through inadequate security practices all the time and a SSH server is a direct line to total control.

3
  • Thanks for the prompt response. I will update my question accordingly (I thought mentioning that I had followed the previous instructions - made it clear that I had done the things you mentioned). I will make the steps I took more clear.. Please gimme a few minutes to do so.. Thanks Mar 29, 2016 at 9:51
  • I deleted the port forwarding configuration in the router, then entered EXACT parameters AGAIN. Now ssh --vvv gives me a much more detailed response - and I can now login into the server. Could you please remove my IP address from your answer, so I can accept it?. Thanks Mar 29, 2016 at 10:51
  • Hmm, I'm experiencing the same problem again .... Fisrt I had a message saying "No route to host". Tried again, now I get "connection refused" .. Also, ssh --vvv output is the same as ssh -v. The one thing that's definitely change is that previously (when the setup was working), the router correctly identified the host machine and displayed it's name as the device to foreward to. However this time round it say's "unknown device", and I have to match the device by its Mac address ... Mar 29, 2016 at 14:54

You must log in to answer this question.

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