26

I was trying to set up a small home server.

I use dynamic IP adress. My router's wan adress is like this 100.70.81.xxx and my public ip is 81.213.177.xx

I made port forwarding in my router. www, smtp and pop3 ports are open. But still my server is not accessible from public internet I think.

So should my computer be behind a Carrier Grade NAT. If this is the case is it still possible to set up a web server behind a CGN?

1

6 Answers 6

13

Your router's "WAN" address is from the private 100.64.0.0/10 range (which is kinda like 192.168.x, but dedicated specifically to CGNAT). So that means you're behind CGN and the global address you're seeing is shared between multiple customers.

So the only ways to set up a server behind a NAT you don't control are:

  • Make the ISP do port-forwarding... yeah, that's not gonna happen. (Even though in theory NAT-PMP was supposed to permit that.)

  • Obtain your own global address from somewhere else, for example there are VPN providers which support server hosting and can give you a static address.

  • If you have IPv6, that would be globally reachable, though you'd additionally need a service which can proxy connections from IPv4-speaking clients to your IPv6-only server (e.g. CloudFlare might do the job).

(IPFS also comes to mind as option 3¾ – recently I've seen a few static-page websites hosted via "web-to-IPFS" proxy servers. From the outside it looks like a completely normal domain which is aliased to gateway.ipfs.io.)

5
  • 1
    do you have an example of a VPN provider with that functionality?
    – Juan Leni
    Commented Apr 8, 2018 at 15:27
  • 1
    Also curious about a VPN provider that has the ability to give me a static IP.
    – Jguy
    Commented Nov 30, 2019 at 16:25
  • I'm using OpenVPN (free) running on a Lightsail instance (U$S 3.5/month). The tricky part comes when I want to configure the client on the Ubuntu Server.
    – nicozica
    Commented Apr 1, 2020 at 21:25
  • IPFS is quite an interesting option, thanks for reminding me! docs.ipfs.io/how-to/websites-on-ipfs/single-page-website/… Commented Feb 6, 2021 at 17:55
  • Or Ask your ISP to remove you from CGNAT. I just called my ISP this week to remove it, and they did so even when I am on a residential connection. Saved me the time and money setting something on a VPN or whatnot.
    – iamjoshua
    Commented Aug 26, 2022 at 1:49
10

ngrok working fine for me. I was about to bang my head but you saved me. my router is behind CGNAT. I signed up in ngrok with free account and believe me its free forever. just need to download ngrok for Linux go to installed dir, Unzip it and run ./ngrok tcp 22 --> i want to access my linux machine from internet over ssh you may like to open port 80 or whatever application you want to access on internet. once run completed it will give you dynamic link with port, you are done

Enjoy !!

1
  • Yeah, this saved me too.
    – Jovylle
    Commented Nov 16, 2021 at 8:12
8

I'd like to mention some other alternatives to ngrok. They are the following, in no particular order:

  1. Serveo (Disabled at the time of writing)

  2. Holepunch.io See pricing there

  3. Packetriot See pricing there

  4. Openport See pricing there

  5. Localhost.run

I'm currently testing the last one and I'm quite satisfied for my needs (personal usage, non-profit).

Source: https://alternativeto.net/software/ngrok/

1
  • want to throw my hat in the ring and also suggest playit.gg. It offers UDP tunneling in addition to TCP and the IPs are static. Commented Feb 28, 2022 at 21:13
6

I had the same issue, I wanted to create a small home based web server and my computer was behind a Carrier Grade NAT so it was not possible to do port forwarding on my router and access my app outside my home network.

The solution I found is called ngrok. No need to do port forward anymore, it will create a secure tunnel to localhost and you'll be able to connect your web application from anywhere.

1
  • But ngrok has limitations right? (Unless you pay for it)
    – Vikas
    Commented Apr 24, 2022 at 15:55
0

You do realize that you can bypass CGNAT with any commercial VPN, however, if you simply want to port forward behind a CGNAT then the process becomes a bit longer. Any VPN can do the trick as they provide a public IP.

Problem is when trying to host a server you need a dedicated IP, not static IP as static IP can be provided to other customers by your ISP, a dedicated a bit expensive is only reserved for you. So for a secure method go for dedicated IP and then port forward, if interested you can follow this process.

1
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Toto
    Commented Oct 4, 2022 at 8:51
-1

I ended up on this thread as I was looking for a similar thing with my router being behind a CGNAT.

I found Zerotier, this solution has solved my issue so I'm just leaving this as an option if someone else has the same issue.

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 28 at 20:15

You must log in to answer this question.