3

I have researched on how to access a Raspberry Pi that has a private address online, and using port forwarding seems to be the answer. But the problem that I have is that I am not using a private home Internet, instead I am conducting my project in my university. I looked around a lot but I couldn't the solution for my problem, or maybe I didn't search well. Anyways, will it work to bring a D-Link router and then configure the router's settings? Given that I am using the Internet of my university to feed the router with Internet.

  • 1
    Good to see lots of potential solutions here. Whatever you do, exercise extreme caution when attempting clever things on university networks. You have almost certainly signed or implicitly agreed to observe your institution's computer use policy. If you're found to be breaching this the consequences are unlikely to be worth any potential payoff. It's entirely possible for network techs to establish the physical location of unannounced/potentially damaging internal network activity and remove you from the building. – goobering Feb 19 '16 at 11:51
8

You can ask your friendly IT department of your university if they could forward that specific port to your RPi. At least, that's what I did and it worked out quite well.

It's not impossible, it just depends on whom you gonna call ;-)

  • This would depend greatly on the university. This might work at a smaller university, but my school wouldn't even consider such a thing since it's a security risk/annoyance and doesn't benefit them in anyway. – Jacobm001 Jan 22 '16 at 17:59
  • Oh this is awesome. I should try this in case nothing else works, but on Tuesday. Monday is a public holiday! – Ahmed Al-haddad Jan 23 '16 at 7:36
4

If your university is internet accessable to the Internet. There is a service call ngrok: https://ngrok.com/. It could 'Expose local servers behind NATs and firewalls to the public internet over secure tunnels' as the offical page said.

1) download and unzip:

wget https://dl.ngrok.com/ngrok_2.0.19_linux_arm.zip
unzip ngrok_2.0.19_linux_arm.zip

2) register on https://ngrok.com/ and you will get a authtoken on dashboard page and execute this command:

./ngrok authtoken <authtoken>

3) after install and register (free account have 1 tcp tunnel). you could use this command to expose your ssh port:

ngrok tcp 22

it will show you a url like this:

Tunnel Status                 online                                            
Version                       2.0.19/2.0.19                                     
Web Interface                 http://127.0.0.1:4040                             
Forwarding                    tcp://0.tcp.ngrok.io:58005 -> localhost:22        

4) It you see this url successfully, do not close this terminal keep it running on your pi's terminal. You could connect your pi from anywhere of the world:

ssh -p 58005 0.tcp.ngrok.io
  • Thanks a lot. I am going to try it but atm there seems to be a problem with the download so I will try with them and hopefully this problem is fixed. Btw, I can choose any port and not necessarily port 22, right? – Ahmed Al-haddad Jan 23 '16 at 7:50
  • @AhmedAl-haddad yes, just change the command 'ngrok tcp 22' to any port you like, it should work. – warmblue Jan 23 '16 at 10:39
  • I was looking for this! – Gene Jan 23 '16 at 11:10
  • @realhu I just found out that my university blocked ngrok :( this could be the most excellent solution :( – Ahmed Al-haddad Jan 24 '16 at 13:50
3

tl;dr: no, you can't

Your university's network is probably designed to prohibit this exact kind of behavior. If you plug your router into the university system, you can forward requests that come to that router to the RPi (usually), but not those coming from the outside world.

This happens for a variety of reasons, none of which are particularly easy or possible to get around. Even if you can, your university probably has rules about that sort of thing, and may even prohibit private routers (mine does, but it is never enforced).

  • Thanks sir. Your answer allowed me to know that I should not buy the D-Link since it won't work except within the university's Internet (for that specific network). Meaning that even different networks inside my university won't be able to see each other :/ – Ahmed Al-haddad Jan 23 '16 at 8:07
3

One way of doing it would be to establish vpn connection to your home and then tunneling traffic from your home to your RPI. Problem here would be (probably is) that your university doesn't allow vpn connections.

2

Hamachi works pretty good for me. But as the other poster already said, it is vpn tunneling and often not allowed by the university. But hamachi is a fairly easy way of connecting via a tunnel. And at least my university doesn't notice it (or doesn't care).

  • Could you please forward me to where I setup the hamachi VPN on the Raspberry Pi?! I tried to look for it but the official website showed me that my Raspberry Pi is not supported and the other links in the other tutorials give me 404 not found message :/ – Ahmed Al-haddad Jan 23 '16 at 9:35
  • Go here: secure.logmein.com/labs Scroll down to "LogMeIn Hamachi for Linux (Beta) command line version" – BallerNacken Jan 23 '16 at 22:48
  • @BallerNecken I can login through my Laptop, but if try through the RPI it tries to connect for a few seconds and then gives me the failed message :/ any idea? I am using the same Internet connection for both.. – Ahmed Al-haddad Jan 24 '16 at 15:07
  • So you have hamachi isntalled on your Pi, ant the pi joins the same network the computer, you want to use for ssh, is in? If that is the case and the Pi shows up in the same network, you need to ssh onto the Pi using the hamachi IP. So something like this 'ssh -X pi@25.156.23.178' (the IP is made up, yours is different). – BallerNacken Jan 25 '16 at 8:30
2

Yaler provides a great tunnelling service which does not require port-forwarding. It's a service that I've used cross-continent, so I know it works well. Here's the link: Yaler.

It has a great section within the docs that takes you through the setup for RPi too.

Your Answer

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

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