0

This is my first post, so hopefully I am doing it right. I am still a complete noob at Raspberry Pis, so bear with me here...

Here is the story. I followed these tutorials on creating a WiFi hotspot, then a VPN router on a Raspberry Pi 3.

WiFi hotspot tutorial: https://pimylifeup.com/raspberry-pi-wireless-access-point/

VPN router tutorial: https://pimylifeup.com/raspberry-pi-vpn-access-point/

Everything works, except there are DNS leaks. I followed the steps very carefully and even reinstalled Raspbian multiple times. On my final reinstall, I compared it to the original Raspbian guide: https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md

There are still DNS leaks on all devices that connect to the VPN router. This did not used to happen. However, ever since it began happening, it has kept happening ever since.

Other troubleshooting steps I have tried:

  • Edit /etc/resolv.conf on the router to only allow the VPN provider's DNS servers (does not work)
  • Edit /etc/resolv.conf on a client (temporary fix, lost on reboot and only affects 1 host)
  • Added:

script-security 2

up /etc/openvpn/update-resolv-conf.sh

down /etc/openvpn/update-resolv-conf.sh

to the VPN config file (works only intermittently). openvpn-update-resolv-conf was already installed by default (https://github.com/alfredopalhares/openvpn-update-resolv-conf)

Is there any permanent fix to only allow the VPN provider's DNS servers to resolve hostnames and block all ISP attempts at DNS resolution?

This is the closest thing I could find, but it also did not help: https://community.openvpn.net/openvpn/wiki/Pushing-DNS-to-clients

Thank you for your time, and if you need any more information just let me know.

  • Why not post your OpenVPN configuration file ? One directive that could help in your situation is block-outside-dns (see this post) but there is a chance that the client will not enforce certain settings pushed by the VPN server. The behavior can be OS-dependent (Windows & Linux) and also network interface-dependent. What happens if the VPN connection drops due to a network issue ? I could imagine that the client restores default settings, and the leaks happen. – Anonymous Mar 10 at 19:57
  • I have some firewall rules on my linux machine which implement a VPN "kill switch" functionality. Essentially you need to create firewall rules which only allow outbound connections through the VPN interface, and to the VPN provider's DNS servers, blocking all other connections. – justinjt Mar 11 at 19:19
2

Try this

sudo nano /etc/dnsmasq.conf

My internet is connected via eth0 then theres a vpn connection turned on

interface eth0
static ip_address=192.168.1.80/24  # Static ip for your rpi
static routers=192.168.1.254       # your Routers ip
static domain_name_servers=1.1.1.1 # Dns Cloudfare Server


interface=wlan0       # Use interface wlan0 
server=1.1.1.1        # Dns Cloudfare Server
dhcp-range=192.168.17.100,192.168.17.120,255.255.255.0,24h # IP range and lease time

sudo reboot
that should fix the dns leak

| improve this answer | |

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.