SSH into raspberry with outside network

I cannot find how to ssh into raspberry pi from the outside network. I have set up port forwarding, on port 80 for my raspberry pi. I have used to obtain the ip address of my computer. I have used DHCP to bind the MAC of my raspberrypi to a particular IP on my localhost, suppose it is: 192.168.0.111.

When I access it locally, it is simply like: ssh and that is it. But how would I do it from outside network? How would I remotely ssh into it now? The following does not work:

ssh pi@<myip> -p 80

so if the ip from httpbin.org is 10.20.30.222, then I would do:

ssh pi@10.20.30.222 -p 80

It feels as if I'm not using the piece of information that is the highlighted part here: 192.168.0.111. Can someone please help me with the right syntax?

Thanks

5

2 Answers

The external port in this case should be port 80 and it should be forwarding to port 22 ip 192.168.0.111 (your Rpi IP address and default ssh port). You should configure all this on your home router.

Then you should be able to connect to your pi by doing:

ssh pi@10.20.30.222 -p 80

If you want to use port 80 in your raspberry then you can change the default ssh port on your RPi in /etc/ssh/sshd_config to port 80.

2

This has already been answered here. I will shortly rephrase a very convenient solution using SSHHub (disclamer, I am the author). It uses ssh's own forwarding to access your Rasperry PI from anywhere. Its reliable, free and pretty simple to setup. Register once:

ssh register

run on your Raspberry PI:

while true; do ssh [username]@sshhub.de -R 22:localhost:22 -N -o ServerAliveInterval=10; sleep 10; done

...and thats it! You can connect your Raspberry Pi from anywhere:

ssh -J [username]@sshhub.de localhost

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like