4

My Raspberry Pi is connected to the Internet through my Wifi hotspot, and I'm able connect to it from my other machines with SSH on the same network.

I want to be able to connect to my Raspberry Pi from outside my LAN, is this possible?

(My hotspot is through my phone service provider, so I do not have access to any router settings.)

4
  • 3
    At the risk of stating the obvious: before allowing external access to your pi (see @p1l0t's answer), you should first change the default userid/password and consider resetting the SSH encryption keys. Commented Jan 13, 2014 at 23:13
  • 1
    @ThatBlairGuy Not as obvious as it should be; I think you're safe. Commented Jan 14, 2014 at 0:34
  • Connecting to the pi from a system outside your LAN requires changing settings on the router (in your case, the phone/hotspot). If this is unavailable, then you will be unable to access the pi from outside your LAN. Commented Jan 14, 2014 at 17:27
  • If the router supports uPnP you can poke a hole in the router pointing to your Pi. Commented Jan 14, 2014 at 18:55

5 Answers 5

2

Yes it is possible, but you will have to open up the proper port (probably 22) from your modem/router firewall settings (and maybe forward the IP). If it is working already on the LAN then that should be all that's really left to do.

EDIT: I should add that you may want to get a static IP or use dynamic DNS to make your life easier unless you want to have to constantly check what your IP address has changed to. If you don't have access to the router settings then you may have to do a port scan to see if it is open. If it isn't you will have to either find a way to open it or get your service provider to do it for you.

3
  • 1
    So you open port 22 and then? How do you acces it? Just put the IP + :22?
    – Loko
    Commented Jan 14, 2014 at 13:36
  • Well yes (but it will have to be from an SSH client of course) it's usually something like ssh remote_username@remote_host 22 is probably the default for the client so you may not even need to put the port number.
    – p1l0t
    Commented Jan 14, 2014 at 15:44
  • Kiz, To answer this below since I don't have 50 rep yet to comment, Eugene's post explains this nicely. The 192 address is your LAN (local network) address. It only works for devices connected to the same hotspot. Your Internet IP (WAN address) is a totally different number. That's the one you will need to connect to from the Internet. Port 22 (unless your savvy enough to change the server port to something that is open [a port scanner can tell you this]) needs to be open though.
    – p1l0t
    Commented Jan 14, 2014 at 16:19
1

192.168.X.X is a private IP range, so you can't connect to your phone from outside of your LAN.

233.X.X.X is public IP witch used when you connect from outside from your LAN.

and ONLY public IP can be recognized from outside of your LAN.

In your case, I think there's no way to connect your phone directly.

but if you have a VPN server that you can connect from your LAN and outside,

then you can connect to your phone.

0
0

Thanks p1lOt, but the problem is i do not have access to the modem/router, i am using my phone hotspot for my internet connection. I have installed the no-ip client on my raspi. the ip of my rasp is pi@raspberrypi ~ $ hostname -I 192.168.43.13 but this is different from the the actual IP. The real IP i that get assigned to no-ip is 223.X.X.X. Is there something missing? (i do not have a router, i am using a hotspot)

2
  • Your response to @p1l0t should really be a comment on his answer rather than a separate answer. At any rate, in order to make the pi accessible from the outside, you do need to be able to configure the router. Part of the router's job (it's firewall functionality) is to keep external systems from being able to initiate communications with the systems on your network. If you cannot configure the router to establish this exception, then you cannot accomplish your goal. Commented Jan 14, 2014 at 17:23
  • Try using Weaved.com. They install an ssh daemon on your Pi which resets every 30 minutes. Commented Jun 14, 2016 at 23:05
0

If your hotspot is based on mobile network, then you simply can't do that. 99% of mobile providers are having such an infrastructure, that everything goes through other internal ip, and you can't do antything about that. They won't allow servers of any type.

-1

Almost every router has port forwarding settings in its advanced options; log in to the router control panel and add a port forward to port 22 (SSH) on your Raspberry Pi. You should also consider setting a reserved address for the Raspberry Pi on your router so you do not need to worry about its IP address changing due to DHCP. Finally, for security reasons, when you expose your Raspberry Pi to the internet, set a strong password, as the default Raspbian password is well known; additionally, consider setting the external port on your router to a randomly assigned port, so a hacker superficially targeting port 22 would not be able to easily detect that the SSH port is open.

1
  • THE OP mentions that he does not have access to any of the router settings. Commented Jul 27, 2015 at 3:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.