Skip to content

NAT VPS with 20 ports: how do you actually organize them?

VPS Hosting by lucgone 22 replies 2.8K views
6 #11

I just use Docker Compose with explicit port mappings and a .env file for the base port. If my provider changes the range I change one variable and redeploy. Not fancy but I am not fancy either.

services:
  nginx:
    ports:
      - "${BASE}:80"
      - "${BASE_SSL}:443"

BASE=30000, BASE_SSL=30001, done.

#12
dragon2003 said:
I rewrote my entire port mapping system in Rust

Of course you did.

#13

Docker Compose for 20 ports is how you end up with 20 containers when you needed 5. I run bare nginx and a handful of static binaries. My entire port map fits in a 12-line script that I have memorized.

Kubernetes solved problems I never had and created ones I do.

#14

In Turkey we have same issue with providers giving high ports. I use HAProxy on a cheap Hetzner VPS in Finland (€3.50/month) as my entry point. Finland to my NAT in Germany is 25ms. Total cost still less than one "normal" VPS with dedicated IP.

The trick is `accept-proxy` on HAProxy side so you keep real client IPs in logs.

#15

I have understand now. So I need a second VPS for the real IP, or use something like Cloudflare Tunnel. I will check prices because my budget is tight. Thank you all for explain SNI to me, I was confuse.

Vive la résistance... électrique
#16

Cloudflare Tunnel works and is free but remember: you are now locked to Cloudflare's network path. I measured 15% slower speeds to EU users compared to direct routing from my Hetzner proxy. For a game server that matters. For a blog, who cares.

#17
digitalsearch said:
Locked to Cloudflare's network path

This is why I self-host the proxy. My Rust config generator outputs WireGuard configs too, so the tunnel is mine end to end. 847 lines was a lie, it is 903 now. I added Prometheus metrics.

7 #18

I am following this thread because I have the exact same setup. Has anyone tried using a IPv6-only VPS as the front end? Some providers give those for $1/month and you get a full /64. Then use NAT64 or something for IPv4 users?

Might be cheaper than dual-stack proxy.

3 #19
jerrygone said:
IPv6-only VPS as the front end

Tried it. Pain. Half the mobile networks in the US still do not do IPv6 properly. Your game server players will complain. Stick to dual-stack for anything user-facing.

#20
jerrygone said:
NAT64 or something

TAYGA on a $3 Racknerd box worked for me as experiment. Throughput was 200 Mbps, CPU-bound on the translation. Not worth for production. Ampere handles it better but why waste the cores.

ARM efficiency does not help if you create unnecessary work.

one small ping for man...

Post a reply

You need an account to reply. Log in or register to join the conversation.

Post reply Preview Save draft