Remote SSH my RPI (non local)

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.
DewGew
Posts: 16
Joined: Thursday 21 April 2016 12:01
Target OS: Raspberry Pi
Domoticz version: V3.5877
Location: Sweden
Contact:

Remote SSH my RPI (non local)

Postby DewGew » Friday 17 February 2017 11:13

I want to be able to access my Pi anywhere (outside a local network) via ssh. Its not working with any android app like JuiceSSH localy on my phone either.
It works fine on local network with my desktop (putty or winspc).
When I connect via ssh over internet I can login with username and password but then nothing happens I get connection timeout.

I have:
[*]i use rpi wifi dongle not ethernet cable
[*] public ipadress is static from my ISP
[*] set my RPI with static ipadress. (also reserved same ipadress in my router)
[*] open port 22 in my router ( Netgear wnr1000v3)

Any Ideas that might help?

shaneben
Posts: 4
Joined: Thursday 16 February 2017 22:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Remote SSH my RPI (non local)

Postby shaneben » Friday 17 February 2017 22:13

Have you looked at Port Forwarding? The static IP on your local network will be different than the outward facing IP. You will need to tell the router where to point port 22 at on the internal network.

So if RPI is at 192.168.1.30 you would set the port forwarding on the router to have port 22 forward to 192.168.1.30.

SweetPants
Posts: 1200
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.7377
Location: The Netherlands
Contact:

Re: Remote SSH my RPI (non local)

Postby SweetPants » Friday 17 February 2017 22:42

shaneben wrote:So if RPI is at 192.168.1.30 you would set the port forwarding on the router to have port 22 forward to 192.168.1.30.

Don't use standard port numbers like 22 for SSH but use port translation like 2222 -> 22. Standard ports are likeley to be used first when somebody tries to hack into your network. If you are using Linux, also install fail2ban for SSH (google for it)

shaneben
Posts: 4
Joined: Thursday 16 February 2017 22:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Remote SSH my RPI (non local)

Postby shaneben » Friday 17 February 2017 23:35

SweetPants wrote:Don't use standard port numbers like 22 for SSH but use port translation like 2222 -> 22. Standard ports are likeley to be used first when somebody tries to hack into your network. If you are using Linux, also install fail2ban for SSH (google for it)


Great advice also look into disabling the user/pass login and use SSH Keys instead.

DewGew
Posts: 16
Joined: Thursday 21 April 2016 12:01
Target OS: Raspberry Pi
Domoticz version: V3.5877
Location: Sweden
Contact:

Re: Remote SSH my RPI (non local)

Postby DewGew » Friday 24 February 2017 11:26

SweetPants wrote:
shaneben wrote:So if RPI is at 192.168.1.30 you would set the port forwarding on the router to have port 22 forward to 192.168.1.30.

Don't use standard port numbers like 22 for SSH but use port translation like 2222 -> 22. Standard ports are likeley to be used first when somebody tries to hack into your network. If you are using Linux, also install fail2ban for SSH (google for it)


I don't use standard port and i forward the ip in my router. I found the problem. I can´t connect remotely with wifi on my rpi. I change to LAN and
now it works.

//DewGew

Holland
Posts: 313
Joined: Friday 12 July 2013 13:53
Target OS: Raspberry Pi
Domoticz version: Beta Ch
Location: The Netherlands
Contact:

Re: Remote SSH my RPI (non local)

Postby Holland » Friday 24 February 2017 12:06

Best to start a VPN session, e.g OpenVPN, and then you can do anything you want on your network. Works perfect in my case.

CalimeroInc
Posts: 1
Joined: Sunday 26 February 2017 16:37
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Remote SSH my RPI (non local)

Postby CalimeroInc » Sunday 26 February 2017 16:40

I had a similar problem with my Raspberry. SSH worked fine when it was connected via LAN, but hanged when I tried to login via Wifi.

Found the solution here: https://expresshosting.net/ssh-hanging-authentication/

Edit the two configuration files for the Raspberry Pi:

/etc/ssh/ssh_config
/etc/ssh/sshd_config

And add the following line to the bottom of the configuration file:

IPQoS 0x00

And restart sshd (sudo service sshd restart).


Return to “Other questions and discussions”

Who is online

Users browsing this forum: No registered users and 2 guests