Anthony1
Posts: 8
Joined: Fri Oct 12, 2012 8:19 am

SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 9:26 am

Hi - I'm an RPi noob trying to use SSH to connect to the Raspberry Pi from outside my home network.

So far:
I have SSH working and can connect from my home network using Putty on a PC or vssh on iPad.
I have set a Static IP on the RPi
I have configured my router to forward Port 22 to the RPi's static IP.

When I try to connect from outside the home network it just times out. Also when I try to check the port using whatismyip dot org it also times out. Is this likely to be a router issue or do I need to do something on the Pi to allow access to it from outside the home network?

Any help would be great.

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 11:48 am

This could be your ISP blocking all incoming traffic.

Some ISPs are quite nasty like this.

Mantrid
Posts: 33
Joined: Thu Jun 21, 2012 8:44 am
Location: Middlesbrough/Armagh

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 11:50 am

I just use no-ip for mine, so i can ssh into the pi from my phone using root@<no-ip username>

you can put a small client onto the pi to call home and refresh what the site holds as its ip address so if your ISP changes your router ip it'll still be ready

scyhe
Posts: 2
Joined: Fri Oct 05, 2012 12:39 pm

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 11:51 am

I have similar problem, in local network i can use ssh or ping raspberry, but when i'm connected to WWAN by 3G modem i can't login by ssh or ping wan interface from outside. My 3G connection is working, i can ping remote hosts from pi.

Anthony1
Posts: 8
Joined: Fri Oct 12, 2012 8:19 am

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 11:53 am

Thanks bredman, I did check that and apparently my ISP does not block any ports forwarding from what I could find.

User avatar
RaTTuS
Posts: 10514
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 11:59 am

what IP are you using ?

sign up for qa free no-ip.com http://www.no-ip.com/services/managed_d ... c_dns.html

follow the instructions

make sure you are using the correct IP
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Anthony1
Posts: 8
Joined: Fri Oct 12, 2012 8:19 am

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 12:02 pm

Hi Mantrid - I have a static external IP from my ISP, so I'm not sure that I need to do this?

User avatar
daveg
Posts: 137
Joined: Thu Dec 01, 2011 9:36 am

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 12:18 pm

If you get a static IP from your ISP you dont need to use a dynamic dns service.

What router do you have?
Have you had other port forwarding working for other services/devices?
When you configured it to forward SSH traffic, did you forward TCP, UDP or both?
Have you tried rebooting the router in case it needs a power cycle to implement config changes?

Anthony1
Posts: 8
Joined: Fri Oct 12, 2012 8:19 am

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 12:54 pm

Router is a Linksys WAG200G
I have never tried port forwarding before so I'm not sure if it works
It is configured to "Both"
Just tried a router re-boot and still not working

Is there a simple and sure way to check if port forwarding is working on my router at all?

Mantrid
Posts: 33
Joined: Thu Jun 21, 2012 8:44 am
Location: Middlesbrough/Armagh

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 12:57 pm

are you trying this outside your house?

there's a weird issue with my router that i can access my pi from it's external IP address ONLY if I'm not connected to the same router as the pi is currently on, in that case i have to use its local ip

no idea why but i've never investigated it since it's no extra hassle. have you tried accesing it externally whilst not connecting to the same router your pi is? ie just through phone 3g instead of wifi?

edit: I know you specified you tried outside your home network bu ti just wanna check i'm not misunderstanding that as just using the external IP :)

Anthony1
Posts: 8
Joined: Fri Oct 12, 2012 8:19 am

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 1:22 pm

Yep, trying it from my phone on 3G and no good.

Mantrid
Posts: 33
Joined: Thu Jun 21, 2012 8:44 am
Location: Middlesbrough/Armagh

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 1:30 pm

so it's a static ip on the pi, static ip on the router, ports are forwarded to the pi, ssh is running because you can connect to it locally but not externally

I'm going to suggest it's the router somehow then, should it allow port 22 to connect outbound as well? can't remember off-hand..

thogue
Posts: 131
Joined: Wed Sep 19, 2012 2:16 am

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 1:37 pm

Sounds like its a port forwarding issue,

maybe post a picture of your rules in your router?

If possible, I recommend checking the port forwarding from another machine, on another external network. Telnet is a good way to check for tcp connection to rule out any issues with ssh

Code: Select all

telnet ip 22
when you tested from your phone does your phone tell you if the connection times out or was rejected?

edit : Does your UI look like this http://ui.linksys.com/files/WAG200G/1.0 ... arding.htm

SSH 22 22 TCP IP.OF.R.PI should do it.

User avatar
malakai
Posts: 1382
Joined: Sat Sep 15, 2012 10:35 am
Contact: Website

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 1:42 pm

To test your port from home http://www.whatsmyip.org/port-scanner/ click server

If ssh is open then you are being blocked at the outside source.
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)

Wendo
Posts: 142
Joined: Sun Jun 10, 2012 8:27 pm

Re: SSH into Rpi from outside local network - not working

Fri Oct 12, 2012 11:46 pm

The other possibility is that the Pi doesn't have a gateway set, although were that the case I would expect this would have started in not being able to access the internet from the Pi

Anthony1
Posts: 8
Joined: Fri Oct 12, 2012 8:19 am

Re: SSH into Rpi from outside local network - not working

Sun Oct 14, 2012 4:05 am

Ok, I managed to open the Telnet port 23 on my router using my PC and Telnet Server, and I have confirmed that this port is open using whatsmyip. To do this I had to open the port on my firewall on the PC and turn on Telnet Server.

I then noticed that the pi was not showing up not show up in any connections to my router, not in the DCHP list.

I have now edited /etc/network/interfaces back to what it originally was. Then I rebooted and the pi was assigned a non-static ip from the router. I used that IP in the port forwarding settings and hey presto I can now log in over 3G!

My only confusion now is what did I do wrong in setting the static IP so that the router couldn't find it?

interfaces looked like this:

#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.20
netmask 255.255.255.0
gateway 192-168-1-1.tpg

Anthony1
Posts: 8
Joined: Fri Oct 12, 2012 8:19 am

Re: SSH into Rpi from outside local network - not working

Sun Oct 14, 2012 4:12 am

Ok I'm not sure why I had the Gateway listed like that. I guess that is the domain name not the IP?

Correct gateway was 192.168.1.1 and now working with static IP from outside my network.

Thanks all for your help in resolving :)

User avatar
Dweeber
Posts: 606
Joined: Fri Aug 17, 2012 3:35 am
Location: Mesa, AZ
Contact: Website

Re: SSH into Rpi from outside local network - not working

Sun Oct 14, 2012 5:26 am

Anthony1 wrote:Ok, I managed to open the Telnet port 23 on my router using my PC and Telnet Server, and I have confirmed that this port is open using whatsmyip. To do this I had to open the port on my firewall on the PC and turn on Telnet Server.
Hopefully you are not leaving telnet open to the Internet.... Opening SSH port 22 might make sense, but telnet port 23 is not considered safe.
Dweeber A.K.A. Kevin...
My RPI Info Pages including Current Setup - http://rpi.tnet.com

Return to “Troubleshooting”