Best way to get IPv4 connectivity to my self-hosted services
Hi, I live in Germany and only have public IPv6. My address changes only very, very rarely and has never changed in the time I've been self-hosting.
I also have a very small, pretty cheap VPS with static IPv4/IPv6 – which would seem like a great fit for some sort of tunneling/proxy setup. Now comes the question: What/how should I use it?
I would like to not have the additional latency for IPv6 enabled hosts, can I just setup a reverse proxy for IPv4? Would Tailscale work for my usecase, what are some resources you found useful when using it?
Currently, I'm just hosting everything IPv6-only and hoping my address never changes, but that does not work for everyone, as especially many new buildings with fiber optic connections still only have IPv4 (strangely).
I'd just set up the reverse proxy on the VPS and make it forward everything via IPv6. But you could also use a tunnel/VPN, everything from Tailscale to Wireguard or even an SSH tunnel would work. And there are dedicated services like Cloudflare, nohost, neutrinet, pagekite...
This. Using simple ssh tunneling with port forwarding in a similar scenario. Working flawlessly with zero maintenance for 5 years and counting. Very reliable
Not really reliable, much less than wire guard. If your connection is unstable ssh not the best option. Autossh make it better, but still after a forced disconnection ssh will take a while to drop and reconnect. Wire guard is much better. I moved from ssh+autossh to wireguard and wished I did that sooner.
Tailscale is amazing. When i first started self hosting i tried a bunch of things to avoid a companies solution but tailscale just works perfectly and form what they say in interviews they dont intend to change the free tiers. Its also open source and there's headscale so eventually you could not rely on the company at all.
I switched from Tailscale to headscale, and I still would suggest Tailscale to anyone. It’s just really done well and they seem to actually love that self-hosters and hobbyists use their stuff.
Plenty of IPv4 only networks still exist from which you would not be able to access the services. I am in a similar situation as OP with my offsite address being IPv6 + CGNAT IPv4 and my own address being IPv4 only.
Yes, you can just use a reverse proxy for IPv4 only and point it to the IPv6 upstream. That is what I do, with a separate DNS record which then combines the two. See the DNS records for id.knifepoint.net (CNAME), http.vineta.knifepoint.net (AAAA, A) and vineta.knifepoint.net (AAAA).
Another option if you need public access without something like tailscale would be to use ddns and a AAAA record. Something like https://github.com/ddclient/ddclient would help do that.
That way if the IP changes, you'd pick up on the change for your vanity url within a few minutes.. and can get https certs for that url as well.
Edit: I reread the OP. This doesn't help if clients need direct ipv4. Sorry about that.
I have a similar situation, where I only get a public IPv6 prefix. I ended up renting small vps at netcup and installed OpenVPN and ha-proxy. My home router connects to the VPS's public IP and I do port forwarding for the services I need, or use the proxy.
Initially I setup SNAT for my web server (otherwise replies were going out the wrong interface) and that meant you don't see the public IP of the connecting client in your access logs.
Recently I switched to using ha-proxy which does tcp level proxying and works well with ports 80 and 443 and Traefik, which i use to expose my docker containers.
My connection chain looke like vps -> ha-proxy -> OpenVPN -> port forward to Traefik -> reverse proxy to the final service. It's not a fast server, and I didn't measure latency, but it's for sure not small.
As others have mentioned, ha-proxying to your IPv6 might be an interesting solution, and I think I will also try it out.
I have a VPS hosted on Digital ocean with Nginx running as proxy, I use openvpn to connect to the VPS and access all my services over the VPS ip address.
I own a domain and forward all the requests from my domain to the Home server IP from my VPS, very useful because I can use different subdomains for different services all on port 80 or 443 even though the service is running on random port.
Dynamic dns to whatever your local hosted services use in case your local ipv6 changes. I’d just use the vps vpn for everything though unless the speeds are really bad.