so I was hosting a server using NGINX on a Raspberry Pi using a T-Mobile mobile router. All was working fine, till I noticed today that T-Mobile started to put me behind a NAT sometimes. So I heard you can still access the server if you set up a VPN network, but I have no idea on how to do it. I searched on the internet but didn't find any tutorials on how to do it using a mobile network, so I thought to ask here. Sorry if this question has been answered before.

I heard you can still accesd the server using VPN or SSH-Tunnelling here: https://superuser.com/questions/277218/ssh-access-to-office-host-behind-nat-router

  • You need to ask a specific question and show what you have tried. Where did you hear this about the VPN, maybe that same source has a tutorial? Also, you should look through the questions that have already been asked, especially if you think that your question may have been asked already. – user1794469 Jul 13 '15 at 18:32
  • I edited the question. I looked through alot of questions but I think none apply to my case – qwertz Jul 13 '15 at 18:36

I like NAT. It sort off keeps the internet outside our private internet while still letting you access all the (public) internet. So security wise a nice thing, so to speak. In your case though, a nightmare. That's why NAT doesn't exist in IPv6. So first suggestion, can you get it to work with IPv6? Second suggestion, call T-Mobile and complain. Tell them you need to get a public IP address assigned, so you can access your Raspberry or anything else you like, e.g. video surveillance. You may need to complain a lot until you get to someone who understands what you are talking about.

Third suggestion, would a VPS in the internet be sufficient for your needs? VPS are cheap, powerful and can be used for a lot of things.

If all fails and you really need to have your Raspberry accessible from the internet, get a VPS, install the flavor of Linux that you like on it and setup a VPN from your Raspberry to the VPS. So the Raspberry is the client and the VPS the server.

Since you don't have a permanent IP address, you will need to configure the VPN to autodetect changes in IP configuration. For ssh you would need some custom scripts, since that feature is not included in ssh. "Mosh" may be a better alternative to ssh.

Personally I would look at StrongSwan with ikev2 https://en.wikipedia.org/wiki/Internet_Key_Exchange for a vpn that can handle changing IP on the client side. Google for Roadwarrior configuration with strongswan.

I hope that helps to get you started.


If you have another server somewhere you can run SSH tunnel to connect to it, or configure OpenVPN client on your RPi device to connect to it.

SSH tunnel can help you but it will be hard to maintain if connection lost due internet fails or something else. OpenVPN looks more stable in my book.

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.