Welcome to the madness world of networking! I will be your none the wiser guide.
Your phrasing is not clear, I am assuming your YunoHost server and VPN endpoint are on separate machines.
Solutions I think of right now:
Networking route
Let’s try adding the following commands to the scripts. They are adding a route to your YunoHost server (and only to this single address with the /32 CIDR) from your WireGuard server.
No, if you do that, you tell the whole network that every machine’s localhost has to go through your VPN server.
If WireGuard and Pi-Hole are on the same machine, it is much simpler. Remove the extra postup and postdown commands. I have investigated on my own network, and you need to do one extra alteration:
If PiHole and WireGuard VPN are on the same machine
In PiHole settings:
Interface listening behavior:
Listen on all interfaces
Allows only queries from devices that are at most one hop away (local devices)
Create a new /etc/dnsmasq.d/vpn file and add your VPN server address to listen-address:
listen-address=10.10.10.0
Restart dnsmasq: systemctl restart dnsmasq
Edit on 2021-10-21: Use a dedicated conf file to avoid making the regen-conf unhappy.
You’re my Wireguard hero. Thank you for taking the time to troubleshoot this, and write your answers in a way that will be very beneficial to others reading.
Seriously. I’m starting to understand a bit about Wireguard now
Thanks!
Wireguard works great outside my network, but my computer’s internet on my own wifi is weird. It doesn’t like listening on all interfaces for some reason. I need to investigate pihole a bit. All the phones on the Wifi work great, just the computer can’t resolve URLs now that it’s listening on all interfaces. So strange.
→ Mini solution to this: added a 02-interface.conf file to /etc/dnsmasq.d/ with two lines: interface=wg0 ; interface=enp4s0 #my ethernet interface
That’s interesting. I have Yunohost on a Pi at home and acting as a 'Brique" (vpn providd by Franciliens) and the hotspot app for my wifi network at home. Do you think I can install the Wireguard app on my Pi and connect my phone (or laptop while travelling) to my Yunohost through Wireguard so I can use the vpn provided by Franciliens on my Pi?
Thank you.