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.

Moderators: leecollings, remb0

Post Reply
User avatar
DewGew
Posts: 581
Joined: Thursday 21 April 2016 12:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10618
Location: Sweden
Contact:

Remote SSH my RPI (non local)

Post by DewGew »

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?
Raspberry Pi 3 | domoticz | Aeon Labs Z-Stick GEN5 | RFlink gateway
NanoPi NEO-air | REGO6XX interface | Machinon theme | Homebridge | Domoticz Google Assistant | ideAlarm
shaneben
Posts: 4
Joined: Thursday 16 February 2017 21:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Remote SSH my RPI (non local)

Post by shaneben »

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

Re: Remote SSH my RPI (non local)

Post by SweetPants »

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 21:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Remote SSH my RPI (non local)

Post by shaneben »

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.
User avatar
DewGew
Posts: 581
Joined: Thursday 21 April 2016 12:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10618
Location: Sweden
Contact:

Re: Remote SSH my RPI (non local)

Post by DewGew »

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
Raspberry Pi 3 | domoticz | Aeon Labs Z-Stick GEN5 | RFlink gateway
NanoPi NEO-air | REGO6XX interface | Machinon theme | Homebridge | Domoticz Google Assistant | ideAlarm
Holland
Posts: 179
Joined: Friday 12 July 2013 13:53
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta Ch
Location: The Netherlands
Contact:

Re: Remote SSH my RPI (non local)

Post by Holland »

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 15:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Remote SSH my RPI (non local)

Post by CalimeroInc »

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).
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest