I'm connected via a 4G modem. Got this setup about 3 years ago. In the beginning it was enough to look for the public IP (what's my IP). The modem showed some sort of private ip in the ui. I'm running stuff at home (Homeassistant, Gitea,) and bought a domain and pointed it to my home IP via Cloudflare. After some time I've noticed my modem shows the public IP also internally. For about 2 years now it ran flawlessly, the IP changed from time to time, but not really more than once in several weeks.
For about a week all stopped working and the modem shows IP 100.xxxx and outside 85.something
I guess I'm behind NAT now.
Normal port forwarding on the modem is useless now.
Is it possible to open the ports via UPNP? I've tried via miniupnp from my Ubuntu server, but it just throws an error.
N.B. to anyone reading this: ask your isp to "opt out of CG-NAT". Talking about IPv6 may confuse the staffer you're talking to, it's partially related but not the fully picture.
You're already using cloudflare, so check out cloudflare tunnels. You install their software on your server which makes an outbound connection, bypassing the need for open ports or a public IP. Note this only does http traffic.
Another option is tail scale, which won't make your site public but will let you access it remotely on devices you have their software/app on.
Been using Tailscale behind CG-NAT for years. It works wonderfully and very rarely needs to route through the DERP infrastructure - it’s almost always a P2P connection.
A solid workaround is an ssh reverse tunnel with gateway ports enabled. You can do it for pennies with a cheap VPS.
With this option you open an ssh tunnel outbound and then you can connect back through it from the other side for whatever local services you want to run.
Just remember to enable gateway ports in the VPS side sshd.conf and disable or adjust any firewall on the VPS so the internet can come in through the VPS ip address and tunnel back to your local system.
While I use ssh tunneling to access systems on a temporary basis, usually http, some caveats:
I don't know of a daemon to set up locally that will re-establish tunnels on power loss and the like. Not technically-difficult, but something one probably wants if this is going to be how he's gonna get at the system long-term rather than "I just need one-off access".
One other downside -- the service that the user here is aiming to expose is apparently ssh. For me -- reaching an http server -- wrapping the connection for remote use is desirable. For him, it probably isn't, as there'll be two layers of encryption. Not the end of the world, but it's a hit. You do want encryption in the outer protocol at least insofar as you need it to protect authentication to the VPS anyway.
I need more ports to be exposed - I'm running secure DNS, Git on one port, Webmin on other, Jelllyfin (I can live without that on data), HTTP server on 800/443, Homeassistant 8123,...
I also had 3389 open for remote desktop to my Windows machine, etc.
For sure. If you really need to host thrn get the right package of internet services for that activity. If you need a fast fix for a small issue, this method gets around most ISP attempts to block hosting.
Have you reached out to your ISP to see if they can give you a dynamic public IP? I recently swapped to a new ISP that was using CGNAT but after contacting their support team with my use case, they were happy to set me up with a public IP so I could continue my self-hosting.
This. I had the same situation being put behind CGnat and told them my security webcam needs port forwarding from outside and they had me back to a public IP within minutes.
I tried that and couldn't make it work. My server was unable to receive any http requests. Then I tried doing some tweaking in my ISP router configuration but with no success. So far cloudflare tunnel was the only solution I found
Buy a cheap VPS, setup a Wireguard or OpenVPN server (wg-easy is quite nice). Then something like Nginx Proxy Manager or plain nginx and expose your services over that.
Edit: if you need help, hit me up, love sharing my knowledge
I second this. I use a couple of dirt cheap VPSs from racknerd ($24/yr for 1 CPU/512Mb ram, but you can find coupons online to get them for $10/yr 1CPU/768mb ram) one does port forwarding over wireguard to my mail server so I can keep all my data in house, the other hosts an NGINX reverse proxy for all my web services. Works great. I use the reverse proxy for nextcloud and jellyfin for myself and 6 other users. Never had an issue. (Well, never had an issue I didn't cause myself at any rate.)
It's a little harder to set up than some of the other suggestions, but it's cheap, fully transparent to users, and doesn't expose your home network to the outside world.
Netcup is my favourite hoster in the EU, but I live in DE. 2€/m for 2c, 2/4gb ram, lots of traffic. They have coupons from time to time or xmas/easter/... deals. The whole front- and backend works like a charm too. Upload your own isos/qcow images, download backups, KVM is awesomely implemented too.
Sadly they don't take crypto and you need a call verification or id via mail for your first purchase (understandable as a german hoster), besides that just wonderful :)
Personally I would strongly recommend learning how to do all of this. And then abandoning it for tailscale or something similar once you know what they're doing behind the scenes. It's incredibly useful knowledge but it's also nice to have so much of the process automated and best practices like key rotation done for you. Plus unless your network is hugely crazy or enterprise, you can manage for the really great price of $0.
And if you really really want to self host (which I understand) there's headscale for a lot of the features.
I use a VPN that I setup on an Oracle free tier VPS when I need to access my stuff over IPv4. I also have IPv6, so I can connect directly when using 5G on my phone.
You say that as if most don’t hold a monopoly in their available regions. At least in America, you typically have the choice of one, maybe more if you’re in a largeish city, and I suppose you have the option of a 5G hub but that’s terrible for running services.
Ouch, I was not aware of that. Here in scandinavialand we have a few local or regional ones in each area, plus a few big ones that cover the entire country.
Once the fiber is in the ground, "any" ISP can use them, regardless who buried it. I think it's a remnant from 20ish years ago when the default was ADSL over copper, and the telecom cables were considered public infrastructure.