I have setup a Wireguard VPN on my raspberry pi and I can connect to it via client app on my mobile phone. I can access the internet though the phone and I confirm that the phone is using the same IP of the raspberry pi, so the VPN is working for the outer internet.

But I have a local webserver on my Pi, which I can access on the pi using a direct internal IP (, using raspberrypi.local hostname, or by using a custom host defined in /etc/hosts file.

However, in the phone and over VPN I can only access that local webserver over the internal IP: raspberrypi.local or any other hostname defined in /etc/hosts does not work.

How can I resolve this?


I've indirectly solved this issue by installing Pi-Hole, setting up local hosts there and enabling it as the DNS server for all my clients. Now I can access my home network via VPN with local hostname resolution + added benefit of DNS level ad blocking.

Pi-Hole and Wireguard VPN play very nice with each other (Pi-Hole detected Wireguard and offered to do all configurations by itself).


I have a hostname that I can resolve as "hostname.local" while I am connected directly to my LAN.

When I am connected via wireguard, I can only reach the hostname by appending a period (or dot) after the hostname: i.e. "hostname."

While connected through wireguard:

ping hostname.local    (doesn't work)
ping hostname.         (works)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.