Port Forwarding/Redirecting
from Tywele@lemmy.dbzer0.com to selfhosted@lemmy.world on 03 Sep 2024 14:15
https://lemmy.dbzer0.com/post/27119318

I’m a beginner in networking things but due to my ISP I can only open a certain range of ports in my router to be accessible from the outside of my network (something like ports 11000-11500).

That means I can’t open port 443 to access my reverse proxy from the outside. Is it possible to redirect all traffic that’s coming from one of the ports in the range to port 443 of my server?

I haven’t found that possibility in my router (Fritzbox 7530) so is there a way to do this on my server (running Fedora Server)?

#selfhosted

threaded - newest

0x0@programming.dev on 03 Sep 2024 14:18 next collapse

What exactly are you serving? Chances are you can change the listening port.

danielquinn@lemmy.ca on 03 Sep 2024 14:33 next collapse

At the firewall level, port forwarding forwards traffic bound for one port to another machine on your network on an arbitrary port, but the UI built on top of it in your router may not include this.

If it’s not an option in your Fritzbox, your options are:

  • Make the service running on your internal network listen on one of those high-number ports instead.
  • Introduce another machine on the network that also performs NAT between your router and your machine
  • Try to access the underlying firewall in your router to tweak the rules manually. Some routers have an admin console accessible via telnet or SSH that may allow this.
  • Get a new router.

The first and last options on this list are probably the best.

funkajunk@lemm.ee on 03 Sep 2024 14:39 next collapse

Get a cheap VPS on digital ocean, and make a wireguard tunnel from there to your server. Then you don’t need any open ports on your home network

wjs018@lemmy.world on 03 Sep 2024 14:42 collapse

This is what I do. I have a VPS that handles all the 443 traffic and then proxies it back to my home server on the correct port. I also just serve some things directly from the VPS since I have it already. It also works well to have a second box for things like uptime monitoring.

abff08f4813c@j4vcdedmiokf56h3ho4t62mlku.srv.us on 03 Sep 2024 15:04 collapse

And one can prototype this for free by using something like localhost.run or ngrok.com

ShortN0te@lemmy.ml on 03 Sep 2024 14:43 next collapse

Yes that is possible. You can select in the UI that port A forwards to local Host B to Port B.

[deleted] on 03 Sep 2024 14:45 collapse

.

abff08f4813c@j4vcdedmiokf56h3ho4t62mlku.srv.us on 03 Sep 2024 15:26 next collapse

So, here's a page from the online manual that specifies how to do this specifically for the FritzBox 7530

https://en.avm.de/service/knowledge-base/dok/FRITZ-Box-7530/893_Configuring-static-port-sharing-in-the-FRITZ-Box/

Based on the original post though I am 100% sure that OP has already seen this page, already tried it, and therefore knows that the warning under 2.10.b. applies to the OP's case (i.e. FritzBox doesn't allow it from UI because the ISP doesn't allow it - that honestly had me wondering just how the FritzBox knows the ISP doesn't allow it, but that's a different topic).

Tywele@lemmy.dbzer0.com on 03 Sep 2024 16:18 collapse

that honestly had me wondering just how the FritzBox knows the ISP doesn’t allow it, but that’s a different topic

Because the Fritzbox uses a DS-Lite tunnel.

abff08f4813c@j4vcdedmiokf56h3ho4t62mlku.srv.us on 03 Sep 2024 16:47 collapse

Because the Fritzbox uses a DS-Lite tunnel.

Thanks, that pointed me in the right direction!

If I'm understanding https://en.avm.de/service/knowledge-base/dok/FRITZ-Box-3490/1611_What-is-DS-Lite-and-how-does-it-work/ and https://superuser.com/questions/1301857/using-pcp-port-control-protocol-in-practice correctly it seems that it's technically via PCP (Port Control Protocol) that this is known, rather than DS Lite per se, but also that PCP only comes into play here because DS Lite is being used.

(Why point out the distinction? For future readers. I can imagine some braindead ISP somewhere (likely a super cheap reseller) offering DS Lite but then not knowing about PCP, and either not offering port forwarding at all - or they do but you have to fill out a form and snail mail them and then they snail mail you back a printed letter containing a list of port mappings.)

ShortN0te@lemmy.ml on 03 Sep 2024 16:22 collapse

You could’ve only posted less info if you hadn’t posted at all…

Edit: Anyone who downvotes me here: This comment I commented doesn’t specifiy which UI of which software therefore it’s a pretty useless comment.

  1. you are not entitled to an answer by anyone.
  2. you are already there. Your router does support that, you just need to select it in the UI.
[deleted] on 03 Sep 2024 19:08 collapse

.

Voroxpete@sh.itjust.works on 03 Sep 2024 22:07 collapse

The reasonable way to approach this problem would have been to ask a follow up question, rather than bitching at someone for not answer in the exact format you required. You’re the beggar here, you get zero fucking say in how much or how little people choose to help you.

Decronym@lemmy.decronym.xyz on 03 Sep 2024 14:45 next collapse

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:

Fewer Letters More Letters
IP Internet Protocol
NAT Network Address Translation
SSH Secure Shell for remote terminal access
VPS Virtual Private Server (opposed to shared hosting)

[Thread #949 for this sub, first seen 3rd Sep 2024, 14:45] [FAQ] [Full list] [Contact] [Source code]

nichtburningturtle@feddit.org on 03 Sep 2024 15:23 next collapse

If you are hosting for yourself, you can use something like Tailscale to access your server from outside.

bmcgonag@lemmy.world on 03 Sep 2024 20:32 next collapse

Short answer, yes, you can forward port 11500 to port 443, but it means you’ll have to go to www.yourdomain.com:11500 and this may or may not work great with you applications inside the network depending on how they are set to run.

Tywele@lemmy.dbzer0.com on 03 Sep 2024 21:14 collapse

That’s what I thought.

lorentz@feddit.it on 04 Sep 2024 08:35 collapse

Yes, you can do it on your server with a simple iptable rule.

I’m a little rusted, but something like this should work.

iptables -t nat -A PREROUTING -d [your IP] -p tcp --dport 11500 -j DNAT --to-destination [your IP:443]

You can find more information searching for “iptables dnat”. What you are saying here is: in the prerouting table (ie: before we decide what to do with this packet) tcp connections to my IP at the port 11500 must be forwarded to my IP at port 443.