0

I've only ever used Windows and this is my first time with a Raspberry Pi. All I wanted is to be connected to a VPN while acting as a hotspot so that my devices that connect to it will also be connected to the VPN.

Here's what I've done so far:

  1. Use this guide: https://howtoraspberrypi.com/create-a-wi-fi-hotspot-in-less-than-10-minutes-with-pi-raspberry/
  2. Was able to connect but no internet so i had to

Code: Select all

net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -j MASQUERADE
  1. Use this guide for openvpn: https://pimylifeup.com/raspberry-pi-vpn-access-point/
  2. Substitute my VPN provider's info, everything connects but there's a DNS leak so I add:

Code: Select all

   script-security 2
   up /etc/openvpn/update-resolv-conf
   down /etc/openvpn/update-resolv-conf

but DNS leak is still there.

Can you guys suggest what should I do?

2
  • What is a DNS leak? What leak does DNS have? Does DNS name resolution work? Can you ping google.com?
    – Ingo
    Dec 21 '19 at 11:50
  • DNS leak - A DNS leak refers to a security flaw that allows DNS requests to be revealed to ISP DNS servers, despite the use of a VPN service to attempt to conceal them. en.wikipedia.org/wiki/DNS_leak
    – MatsK
    Dec 21 '19 at 15:52
0

Your iptables command conflicts with the one from the VPN tutorial, which specifies the interface,

sudo iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE

Also you may need to set a definite IP address for a DNS server, as the tutorial explains, so your internet router doesn’t specify itself as the DNS server (and then forwards your DNS queries through the unencrypted connection).

2
  • I just did what you suggested and my friend recommended the service which she is using for further prevention for leaks. So till now, all is working fine. The service I am using is purevpn.com/features/dns-leak-protection
    – Albert
    Jan 6 '20 at 8:07
  • @Albert Please accept the answer with a click on the tick on its left side or make your own answer to explain how do you solve it and accept it after two days. Only accepting an answer will finish the question. Otherwise it will pop up endless again for years.
    – Ingo
    Jan 23 '20 at 10:19
0

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

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.