I just set up wireguard today on my home network (as an add-on to home assistant, which should just be a container on a little computer on my home network).
I played around with it a bit. I turned off the wifi on my android phone (using the wireguard app), connected to my duckdns address and was able to browse some of the services on my home LAN. I was able to change the peer addresses from global (0.0.0.0/0) to local (10.0.1.0/24). Still works. Neat!
Then I turned on the wifi, leaving the VPN active (this is still on my android phone). But now I can’t reach any of the home network stuff. If I turn off the VPN, then I can reach the LAN stuff again.
I know it doesn’t really make sense to leave the VPN on when I am at home, on my wifi. But really, I am too lazy to turn it on and off all the time manually. Is there a setting I am missing to make 10.0.1.0/24 go through the wifi first (but maybe only on a specific ssid), and then go to the wg adapter second?
Or is there something in my router’s that is broken? It seems like it should still go to my duckdns address, even if it was preferring the vpn, and that it would get forwarded back to wg and end up at the right place anyway.
Edit: Thank you to all the suggestions. IMO, this is the summary:
- ttech32 pointed out that my router isn’t support NAT hairpinning, or NAT loopback, which is causing it to not work when I’m on my LAN
- LundiMcPuffin suggested I configure a second DNS record to avoid the loopback, which works, but wg won’t figure out when it should try to resolve the IP again.
- Packet1 suggested that my internal DNS would refuse to resolve the address, which should make wg fail while on the LAN, which would let the traffic flow as usual. I couldn’t figure that out on my dnsmasq dns server.
- ContinuousEscalation suggested I install the Automate app, which would toggle the VPN when the wifi changed. That would work, but I am hoping to not install any more apps.
Thank you all. I will keep trying new things if anyone suggests them. But for now, I will just play with doing it manually, and if I get annoyed, install automate.