What options are available to setup port forwarding on CGNAT ?

**What I am trying to do - **I need to setup a web server that will run on raspberry pi. The server will use custom port. And one of route will have incoming data from internet

**Issue I’m facing - **ACT ISP uses a CGNAT. So impossible to setup port forwarding

What options do I have ? Please also suggest any reference/guide/manual for the same

  • Will dynamic DNS work ?
  • VPN tunnel to some free VPN service ?
  • Anything else ?

No, you still need a open port. DDNS is useful when you have a dynamic IP facing the internet but in your case since you’re already inside NAT this won’t help.

Not sure about VPN but if you have a VPS you can use ssh reverse tunneling to achieve this. If you want a proper solution you can use any of these GitHub - anderspitman/awesome-tunneling: List of ngrok/Cloudflare Tunnel alternatives and other tunneling software and services. Focus on self-hosting.

Check out https://ngrok.com/ (probably the simplest of all).

1 Like
1 Like

I had an ISP for many years that had me on cgnat.
After trying several methods, the most effective/reliable method I ended up with is the following:

  1. A VPS, preferably Local (e.g. AWS Mumbai servers)
  2. openvpn on server and your router (or any always on Linux machine on the local Lan)
  3. port forwarding using iptables on vps to your openvpn client on local Lan..
  4. port forwarding on local Lan from router (or Linux server) to desired local ip
2 Likes

Saw a post some time back. A member had set up home automation using a vps as a proxy public IP to ping back home from remote networks. The home network router was connected via vpn to the vps.

You could also try zerotier, a popular nat punching software.

Edit- it was superczar, above me :slight_smile:
Check his home automation post

1 Like

Thanks all.
Will check these inputs and revert

Edit :
Set it up using ngrok :slight_smile:

Thanks

2 Likes

Hi all, I resolved this issue by having a pivot VM in AWS and a reverse tunnel, did it to expose Home Assistant to Internet. All the details here: https://thegabo.dev/expose-home-assistant-on-cg-nat-networks/