pownyan
Posts: 4
Joined: Mon Sep 16, 2013 6:52 pm

Shh not working outside router

Mon Sep 16, 2013 6:55 pm

I cant get ssh to work outside my router... I have it set up to forward the correct port (it works with my other linux machine). Is it something i have to do on the raspberry to get it to work?

pownyan
Posts: 4
Joined: Mon Sep 16, 2013 6:52 pm

Re: Shh not working outside router

Mon Sep 16, 2013 8:10 pm

i have already tried that. When i forward the port to the rp and try to ssh in i get nothing (for a few minutes, then it sais it failed), but if i try without forwarding the port i get a connection refused. I can ssh into the rp from inside my network without any problems.

btw, i already use port 2222 for the pi and 22 for the main computer

chilinski
Posts: 16
Joined: Mon Sep 16, 2013 8:08 pm

Re: Shh not working outside router

Mon Sep 16, 2013 8:40 pm

Check your iptables setup. On one distribution I tried, the pi was set to ignore all requests coming from the outside world.

pownyan
Posts: 4
Joined: Mon Sep 16, 2013 6:52 pm

Re: Shh not working outside router

Mon Sep 16, 2013 8:43 pm

This is not a port-forwarding problem, that part at least is working

Thanks for trying :)

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Shh not working outside router

Mon Sep 16, 2013 8:57 pm

The Pi is no different to any other linux computer in regards to SSH. If it works on the local network, port forwarding is about all that left to go wrong. I'd swap your two's ports around and see it it makes any odds.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......


pownyan
Posts: 4
Joined: Mon Sep 16, 2013 6:52 pm

Re: Shh not working outside router

Tue Sep 17, 2013 7:52 pm


Thanks! That worked :D

CreativeGPX
Posts: 3
Joined: Wed Sep 18, 2013 12:49 am

Re: Shh not working outside router

Wed Sep 18, 2013 12:52 am

I'm having the same problem. I have Raspbian installed on my device. I've been doing all administration from SSH over a LAN. However, when I try to connect outside of the LAN it doesn't work. It times out in the SSH client. I run nmap and I get, "22/tcp filtered ssh".

What I tried:
I tried NAT settings in the router (adding a port 22 to port 22 rule for the device).
I tried setting a packet filter rule to pass all things to port 22.
I tried setting the router's IP passthrough settings to have that computer be the "default server".
I tried setting the router's IP passthrough settings to pass everything to that computer.
I tried restarting my router (as some settings I did required that anyways).

I tried this guide for my router on how to enable SSH (it's what I already did anyways):
http://portforward.com/english/routers/ ... 10/SSH.htm

I tried this guide for enabling SSH with iptables:
http://www.thegeekstuff.com/2011/02/iptables-add-rule/

I tried this which is basically the same thing:
http://raspberrypi.stackexchange.com/qu ... to-raspbmc

I tried using a different port from the /etc/ssh/ssh_config and my ssh client.

None of these have given me any progress. Does anybody have any ideas?

CreativeGPX
Posts: 3
Joined: Wed Sep 18, 2013 12:49 am

Re: Shh not working outside router

Wed Sep 18, 2013 2:17 pm

I think I came up with a solution to my problem.

Works: Connecting to Pi's local IP (192.168.*.*) from a laptop in the same LAN.
Works: Connecting to Pi's public IP from a laptop on another network (my cell phone as a mobile hotspot).
Didn't work: Connecting to Pi's public IP from a laptop in the same LAN with NAT/forwarding settings sending ssh to the Pi.

So that implies to me that NAT gets troubled when it needs to work between two LAN resources. I'm guessing maybe since I'm sending something out on port 22 from the laptop, the router thinks it's clever and is sending incoming port 22 traffic to the laptop despite the fact that I set every setting I could find in it to send things to Pi. So in that case, the easy solution is just to connect to only the public IP when outside the network and only the internal IP when in the network. If that's wrong let me know because that's very inconvenient to have to use two different IPs to refer to the same thing depending on where I happen to be sitting at the moment. (I'm using it for Git, so this sort of breaks the "default remote" feature since there are two different IPs for the same default remote. I could use git hooks to figure out which to use transparently, but sometimes the time you waste to save time just isn't worth it.)

I have the feeling some future Googlers are going to love finding this post. So...many...potential solutions to SSH problems! :D

drgeoff
Posts: 11243
Joined: Wed Jan 25, 2012 6:39 pm

Re: Shh not working outside router

Wed Sep 18, 2013 8:57 pm

Quis custodiet ipsos custodes?

CreativeGPX
Posts: 3
Joined: Wed Sep 18, 2013 12:49 am

Re: Shh not working outside router

Sun Sep 22, 2013 9:11 pm

Right that's it. Thank you very much.

Return to “Troubleshooting”