Page 1 of 1

Port forwarding issue: Connection refused by ssh

Posted: Thu Mar 19, 2020 8:27 pm
by leosimon
I have two laptops on my LAN, and I'd like to be able to log onto each of them from outside my LAN, using the ddns.net address I obtained from noIP.com. I can access one of them (sometimes), but never the other one (5540). My understanding is that I have to open a distinct port for each machine. I've done that. For some reason my screenshot of my "IP Reservation" page of the Sonic App wont copy over, but the relevant line says:

Port forwarding
5540 port
8082 > 8082.

When I try to connect to the machine, using the following ssh command

Code: Select all

ssh -v -l simon -YC simon5540.ddns.net -p 8082
I get this error message:

Code: Select all

OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to simon5540.ddns.net [136.152.208.131] port 8082.
debug1: connect to address 136.152.208.131 port 8082: Connection refused
ssh: connect to host simon5540.ddns.net port 8082: Connection refused
I've talked to the noip.com people, who say talk to the sonic people, who say talk to the noip.com people. Could somebody please advise how I might fix this? Thanks very much for any advice.
(I'd be happy to post screenshots from my eero app if somebody to tell me how to do that!)

Re: Port forwarding issue: Connection refused by ssh

Posted: Fri Mar 20, 2020 8:25 am
by js9erfan
Are you able to ssh into the host machine locally? If so then your router's port forwarding and/or firewall rules need another look (can check your port status here). If not make sure on the host machine the ssh server is installed and running, the sshd_config is configured correctly (including 8082 port), that you're using the right password and/or keys and whether the local firewall (if any) is blocking the connection. You can always try changing the port as well in case it's getting blocked/filtered upstream.

Re: Port forwarding issue: Connection refused by ssh

Posted: Mon Mar 23, 2020 2:11 pm
by leosimon
Thanks for your response @js9erfan. It appears that port 8082 was closed but now it's open and I'm still getting the same issue. I opened it by editing /etc/ssh/sshd_config, and now

Code: Select all

sudo systemctl status ssh
returns

Code: Select all

● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-03-23 13:35:12 PDT; 28min ago
  Process: 14289 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 14285 ExecReload=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
  Process: 7321 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 7322 (sshd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/ssh.service
           └─7322 /usr/sbin/sshd -D

Mar 23 13:42:26 5540 sshd[7322]: Received SIGHUP; restarting.
Mar 23 13:42:26 5540 systemd[1]: Reloaded OpenBSD Secure Shell server.
Mar 23 13:42:26 5540 sshd[7322]: Server listening on 0.0.0.0 port 8082.
Mar 23 13:42:26 5540 sshd[7322]: Server listening on :: port 8082.
Mar 23 13:42:26 5540 systemd[1]: Reloading OpenBSD Secure Shell server.
Mar 23 13:42:26 5540 sshd[7322]: Received SIGHUP; restarting.
Mar 23 13:42:26 5540 systemd[1]: Reloaded OpenBSD Secure Shell server.
Mar 23 13:42:26 5540 sshd[7322]: Server listening on 0.0.0.0 port 8082.
Mar 23 13:42:26 5540 sshd[7322]: Server listening on :: port 8082.
Mar 23 13:59:46 5540 sshd[18351]: Did not receive identification string from 45.33.50.1

So it appears that the port is opening and listening. However the command from my other laptop

Code: Select all

ssh simon@simon5540.ddns.net -p 8082
Still returns the same connection refused message as before.

I don't know whether that message 18351 about not receiving an identification string has to do with anything. I don't recognize the ip address

Thanks again for your help!

Re: Port forwarding issue: Connection refused by ssh

Posted: Mon Mar 23, 2020 3:07 pm
by Sonic Guest
First thing you should do is run ssh from the client with -vvvv to get debug messages.