Hi,
I wanted to forward the port to my Traefik install on my TrueNAS server. Unfortunately I have now learned that my ISP restricts the range of ports that I can open externally to 12396-12415, so internally I can open port 443 to port 12400 externally. So far so good, but how do I point my Cloudflare DNS record to this port?
My router is a Fritzbox 7530 if that’s relevant.
You’d need more than their DNS, as DNS cannot forward ports for you (and before anyone mention SRV records, no, it just tells supported applications which port to use; it does not and cannot externally reassign the port used).
I believe the tool for the job here is the Zero Trust Tunnel; in the Dashboard, on the left, look for Zero Trust, and then on the new dashboard, go Access > Tunnels to setup the tunnel. Documentations are here: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/
Currently I am using Cloudflare Tunnel to access my server remotely. But with this I’m always accessing my server through the tunnel even when I’m at home.
I don’t have your specific port issue, but it sounds like the setup I have would get around your ISP port restrictions as use CloudFlare tunnels externally, LAN internally, and no ports open.
If that is a concern (I don’t see much of an issue, but everyone’s got different requirements, so no judgment here at all), then you’d probably want to setup a recursive DNS server inside your network, configure that DNS server to resolve those internal services to your intranet IP address, when it cannot resolve, it recurses to a public one (ie ISP, CloudFlare, quad 9, Google etc). Then, change your network’s DNS to that internal one, so when you’re on your network, you get internal IP address while off network you get CloudFlare tunnel routing.
I think I got it working now. The last time I tried I couldn’t get it to work.
You can create a transform rule (iirc, might be one of the other rules, can’t check right now) that changes the destination port as long as you’re using Cloudflare’s proxy, no need for stuff like srv records.
edit; alternatively you can use cloudflare’s tunnels feature if forwarding doesn’t work
You need either a reverse proxy running on a vps or something outside your network or a tunnel to your server from something cloudflare that can do the proxy for you without opening any ports.
A reverse proxy will be the public server that relays traffic from the standard ports (80, 443) and then fetches the content from your server on whatever port it has open and then returns it to whatever user requested the page.
Cloudflares tunnel can do the same, but without the need to either open a port nor manage an additional web server. However it needs to be running inside your network to facilitate that connection.
You mentioned already having a cloudflare tunnel that you are using, so I’d stick with that. If you want to not access it over the tunnel and use a fully qualified URL, you will need to host DNS internally with the internal IP address (or use hosts files) while keeping the public DNS entry on cloudflare configured with their tunnel.
Or u-turn nat. You could always do u-turn nat.