Let’s say I’ve got Nextcloud selfhosted in my basement and that it is accessible on the world wide web at nextcloud.kickassdomain.org. When someone puts in that URL, we’ll have all the fun DNS-lookups trying to find the IP address to get them to my router, and my router forwards ports 80 and 443 to a machine running a reverse-proxy, and the reverse-proxy then sends it to a machine-and-port that Nextcloud is listening to.

When I do this on my phone next to that computer hosting Nextcloud, (I believe) what happens is that the data leaves and re-enters my home network as my router sends the data to the IP address it is looking for (which is itself). This would mean that instead of getting a couple hundred Mbps from the local wifi (or being etherneted in and getting even more), I’m limited by my ISPs upload speed of ~25Mbps.

Maybe that just isn’t the case and I’ve got nothing to worry about…

What I want my network to do is to know that nothing has to leave the network at all and just use the local speeds. What I tried before was using a DNS re-write in Adguard such that anything going to my kickassdomain would instead go to the local IP address (so like nextcloud.kickassdomain.org -> 192.168.0.99). This seemed to cause a lot of problems when I then left the house because, I assume, the DNS info was cached and my phone would out in the world and try to connect to that IP and fail.

My final goal here is that I want to upload/download from my selfhosted applications (like nextcloud) without being limited by the relatively slow upload speed of the ISP.

Maybe the computer already figured all this out, though - it does seem like my router should know it’s own IP and not bother sending things out into the world just for them to come back.

If it matters, my IP address is pretty stable, but more importantly it is unique to me (like every house in the neighborhood has their own IP).

Updates from testing: So everything does indeed just work without me needing to change how I already had it set up, presumably because the router did the hairpin NAT action folks are talking about here.

I tested it by installed iperf3 on the server then I used my phone (using the PingTools Network Utilities android app, only found on google play and not on f-droid) to connect. Here are the results:

  1. Phone to local IP address (192.168.0.xxx) - ~700 Mbits/second
  2. Phone to speedtest.mykickassdomain.org while still on the wifi - ~700 Mbits/second
  3. Phone on cellular to speedtest.mykickassdomain.org - ~4 Mbits/second
  • needanke@feddit.org
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    1 day ago

    Not necessairly. In Germany CGNAT is quite common. So if one of OPs devices routes via IPv4, the traffic will be routed to the carriers public facing router. I would not consider that local as it physically leaves the cables you control.

    • Possibly linux@lemmy.zip
      link
      fedilink
      English
      arrow-up
      2
      ·
      23 hours ago

      It would be a little weird to have a CGNAT for a local internet connection. Then again, I’m not in Germany.

      • needanke@feddit.org
        link
        fedilink
        English
        arrow-up
        2
        ·
        16 hours ago

        Whrere are you from?

        Because in Germany it is really common.

        I have been looking for a new contract for a while now, because my dsl is shit (thanks to my landlord). But all new cable contracts I can find are NATed (ecxept buisness contracts).

        • Possibly linux@lemmy.zip
          link
          fedilink
          English
          arrow-up
          1
          ·
          14 hours ago

          When you say NATed you are talking about symmetric NAT right? Not just a simple router doing port address translation?

          • Cort@lemmy.world
            link
            fedilink
            English
            arrow-up
            2
            ·
            13 hours ago

            If I understand correctly, it’s nat on the local home router AND nat on the ISP’s router as well. It’s a double nat.

            They’re fairly common in the US with smaller or local fiber networks, but most ISPs offer a static IP for an additional $10/month to bypass the CGNAT

    • ikidd@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      21 hours ago

      Chances are you couldn’t use CGNAT for self-hosting, so you’d be out to an actual IP address that’s forwarding the traffic via something like Cloudflared, but your point stands.

      • needanke@feddit.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        16 hours ago

        Fair, it is a lot harder, but possible (you could vpn your traffick through a vps). Actually one of the reasons I have not changed my terribly slow contract yet.