Hello there!
I would like to access my home server, lying in VPN network using subdomains , via a VPS gateway.
here is the detailled setup:
-
a domain name (domain.tld)
-
A VPS Server wit a static public IP (123.456.78.90)
- Running Debian 11 and Yunohost
- Installed Apps: Wireguard Server (10.10.10.0), Static website, and mails.
- all diagnostic are green.
-
At home, a Rasperry Pi, with external drives
- Running Yunohost
- Installed Apps: Wireguard Client (10.10.10.1), Nextcloud, (and other data-hungry apps).
-
In another home, a backup server, with wireguard configured.
- This would later be use for , you guess it, backups.
-
A few laptops and phones, with wireguard client installed.
Currently:
I have build a VPN network between the 3 servers (adresses 10.10.10.x). I can access domain.tld from everywhere, and any 10.10.10.x addresses when the vpn is on.
What I would like to have is to be able to access the VPN network from outside, using subdomains, without having to fire the vpn everytime I want to get some nextcloud file.
For instance, home.domain.tld should points to the Rasperry Pi at home (so the route should ), and backup.domain.tld should points to the backup server (again via the VPN). The top domain (domain.tld) should point to the VPS server.
I have try to use off-the-shelf apps, but I can’t make it work. I have try to:
- Use the redirect app to redirect the subdomains to the right server, but this fails (too many redirect it seems)
- Use the reverse proxy app, but this fail too (404)
- add
10.10.10.1 home.domain.tld
to the/etc/hosts
file of the VPS server, but this simply does nothing (it redirects to domain.tld)
Some options I am considering:
- Write some proper nginx config (where though ?)
- setup a DNS server on the VPS server (how ? I think I would also have to add some NS lookup on the domain name provider side ?)
- Setup several ssh reverse proxies to bring the home server to the vps (e.g. 10.10.10.1:80 → 10.10.10.0:8001 , 10.10.10.1:443 → 10.10.10.0:8443), and then use the redirect apps. (this feels dirty)
Bonus points:
- also apply the redirection for ssh (so a ssh user@home.domain.tld works from anywhere)
- Share the accounts between the two instances (but I am probably asking too much at this point…)
Potential related posts:
- Distributing Yunohost over 2 servers (one for Nextcloud/storage) - #12 by wbk
- How to have two Yunohosts servers at home? - #9 by folaht
- Homemade WireGuard VPN on a VPS server - #91 by rungeard
- The iptables black magic is not applicable here, as I am not in a one-to-one mapping.
Thanks in advance !