Selfhosted
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Rules:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam posting.
-
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.
-
Don't duplicate the full text of your blog or github here. Just post the link for folks to click.
-
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
-
No trolling.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
view the rest of the comments
Forgot to ask: Is your server a VPN client to the VPS or a VPN server with the VPS as a client? In my config, the VPS is the VPN server.
Not sure about the netplan config (all my stuff is debian and uses oldschool /etc/network/interfaces), but you'd need logic like this:
Server is VPN client of the VPS:
You may also need to explicitly add a route to your local subnet via your eth0 IP/dev. If the VPS is a client to the server at home, then I'm not sure if this would work or not.
Sorry this is so vague. I have this setup for 2 services, and they're both inside Docker with their own networks and routing tables; I don't have to make any accommodations on the host.
Everything I use is in Docker too, I'd much rather use Docker than mess around with host files, but to try it out I don't mind. If you have an image you could share, I'd appreciate it.
Anyway, neither are clients or servers as I just used ZeroTier as a quick setup. On my other infra I use wireguard with the VPS being the server (that setup works well but I only reverse proxy HTTP stuff so X-Forwarded-For works well).
I've no experience with Zerotier, but I use a combo of WG and Openvpn. I use OpenVPN inside the Docker containers since it's easier to containerize than WG.
Inside the Docker container, I have the following logic:
openvpn
along with the other services in the container (yeah, yeah, it's not "the docker way" and I don't care)LAN_SUBNET is my local network (e.g. 192.168.0.1/24) and VPN_SERVER_IP is the public IP of the VPS (1.2.3.4/32). I pass those in as environment variables via docker-compose.
The VPN server pushes the default routes to the client (0.0.0.0/1 via and 128.0.0.0/1 via
Again, sorry this is all generic, but since you're using different mechanisms, you'll need to adapt the basic logic.
Thanks, this helps a lot. So in your OpenVPN config, on the client, do you have it to send all traffic back through the VPN?
You may be able to do it through the client, yes, but I have it pushed from the server:
Okay, can we go back to those iptables commands?
Just to confirm, is the
-o eth0
in the second command essentially the interface where all the traffic is coming in? I've setup a quick Wireguard VPN with Docker, setup the client so that it routes ALL traffic through the VPN. Doing something likecurl ifconfig.me
now shows the public IP of the VPS... this is good. But it seems like the iptables command aren't working for me.That is the interface the masqueraded traffic should exit.