1

I have a RPI 4.

I am running buster os

I have created a web serer.

I use nginx to handle connections

If I access it via my private network it works well.

If I now use a GSM modem on-board my rpi) and try to access my web site via the IP address assigned to that modem it does not work at all.

I can see the as soon as I request a web page the ip address assigned is changed making the call 403.

Upon Googling I found this is something that the telecoms do to stop people doing what I am trying to do.

Are there ways around this?

9
  • 1
    Try a different port on nginx. Something like 8080 which is the alternative HTTP port. They can't block everything. You should than be able to access it via http(s)://[hostname|ip]:8080/
    – kwasmich
    Sep 26, 2019 at 11:34
  • 3
    Most GSM service providers block in-bound connections. You're not allowed to run servers over their networks.
    – Dougie
    Sep 26, 2019 at 11:36
  • 1
    It's also highly likely that for IPv4 out-bound traffic that an service provider is using CG-NAT (carrier grade - network address translation) which means up to 64K users get to share a single public IPv4 address. Having a NAT between you and the public internet makes it impossible to run a server. My public internet facing Raspberry is sitting on a broadband line with a dynamic IPv4 address. I use No-IP to give that a domain name.
    – Dougie
    Sep 26, 2019 at 14:42
  • 1
    @dougie thanks. Very informative. I was looking up the disadvantages of this setup. If I am pinging my server say 6 times a second (hosted with fasthosts etc will that pose an issue do you think?
    – user11286
    Sep 26, 2019 at 17:38
  • 1
    I think the key point here, as identified correctly by @Dougie, is that you're trying to do this over GSM. Providers can - to some extent - filter traffic differently from each other, but I think few will let you do the inbound connection over GSM.
    – Brick
    Sep 26, 2019 at 18:13

2 Answers 2

2

There are answers and comments addressing the question of why this probably isn't working and why it may not be workable as you're doing it now. Regarding the part of your question about how to work around it, I think the most straightforward ways would be either:

  1. Use a proxy with a VPN connection in between
  2. Send your data from the device connected via GSM to another machine that's got a more conventional connection to the internet.

Either of these require a different computer that's connected to the internet, and you'd give out the IP address of that second computer to anyone (including yourself) trying to access your server.

In the first case, it has to run a VPN service that your GSM-connected phone can access and then forward the http(s) requests via VPN to the computer on the GSM side.

In the second case, you'd have your GSM connected phone send updates to the webserver periodically, but the webserver would directly respond to any incoming http(s) requests.

It is not generally true that you need a static IP address for the webserver, but if you don't have one then you need to update any clients (include public DNS if you have a domain name for it) wanting to access it each time its public IP changes. If you are the only user and your provider does not, in practice, change your IP address often, this may be no problem. No-IP, mentioned in a comment, is one of several services that will manage this for you if you don't have a static address.

This is an issue distinct from whether they are blocking certain types of traffic or certain ports, which they may or may not do regardless of whether your IP address is dynamic or static. You'll have to figure out what your provider is doing because we don't have enough specific information about your case to do that for you.

12
  • 1
    Thanks. using vpns as this is an extra cost and something a 3rd party would need to supply me. focusing option 2.
    – user11286
    Sep 26, 2019 at 18:36
  • 1
    You can run your own VPN. It never occurred to me that you'd use a third-party for that, although that is possible.
    – Brick
    Sep 26, 2019 at 18:43
  • 1
    More specifically, you can run the VPN software just on these two machines so that they are the only machines on it and there is no additional hardware. Multiple options for this, but I think strongswan is the most conventional choice.
    – Brick
    Sep 26, 2019 at 18:46
  • 1
    Sorry for these additional questions. I have my RPI and I have many various clients trying to access my RPI server, Where would I put the VPN?
    – user11286
    Sep 26, 2019 at 18:47
  • 2
    @Brick Sorry, it was my fault. I have overseen the GSM modem as part of the RasPi. It's a right question and of course answer here. I have deleted my other comments about this.
    – Ingo
    Sep 27, 2019 at 16:15
2

With most providers you will get a private IP address, usually one like 10.x.y.z. This is not reachable from the internet. That is not necessarily to stop people from doing what you want to do, but to conserve public IP addresses.

If your providers assigns IPv6 addresses, you may be able to use them.

Otherwise, you can use a VPN connection to some VPN provider. These are usually not free, they want wither your money or information about you.

2
  • 1
    I don't know about "most" providers, but I get a public IP address home and using my phone as a hotspot. (Also at work, but that is, as you noted, a static IP.) At home, I can run a server if I port forward and keep track of which IP they give me. (My home is not static, and so the IP can and sometimes does change, but it's always a public IP.) Over phone, I believe the traffic is just blocked even though I get a public IP assigned. I think this answer is wrong at least so far as it is stated as a general conclusion rather than the practice of some specific provider.
    – Brick
    Sep 26, 2019 at 18:11
  • The more I read the comments in this question and answers, the more discouraged me, a newbie in this area, became, because there are too many tedious prerequisite stuff I need to build up. I am hoping IPv6 and 5G would come in a year or two, and I would start learning.
    – tlfong01
    Sep 28, 2019 at 1:01

Your Answer

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