[SOLVED]How to fix dns leaks?

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Mintuser998

Re: How to fix dns leaks?

Post by Mintuser998 »

This one says NY and NJ
Image
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: How to fix dns leaks?

Post by phd21 »

Hi Mintuser998,

Those are DNS server IP addresses. As long as those do not reflect your current ISP or your current location, you should be alright. I noticed that when going to "ipleak.net" or other test websites, that DNS server IP addresses can be from all over the place, and there can be many of them or just one or a few. Theoretically, once you connect to a VPN provider's server, your system should inherit and reflect that location, but I noticed with some VPN providers (regardless of possible DNS leaks), they might use DNS servers from various places, even different countries.

.
VPNbook_US2_Server.jpg
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
Mintuser998

Re: How to fix dns leaks?

Post by Mintuser998 »

Thanks. What do those lines added to the ovpn config do?
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: How to fix dns leaks?

Post by phd21 »

Hi Mintuser998

You are welcome...

Those lines are to help prevent VPN DNS leaks by adding them to the ".ovpn" configuration files.

But, as I stated before not all VPN providers servers leak DNS information, and even if they did, as long as you have changed your local ISP connection's default DNS server IP addresses to a DNS provider's server IP addresses it will not matter, it won't be your local ISP DNS servers, and so you are still secure and anonymous. I am currently in Florida, USA. I did not add those lines to my vpngate server configuration file and yet no DNS leaks, ProtonVPN already had them in their configuration files and no leaks, and I did add them to vpnbook servers which did help.

Here some screenshots of various VPN providers and their server locations along with the results from "ipleqak.net" for each one, and my real (public / wan) IP address is not displayed, nor are my ISP's default DNS server IP addresses. And, as you can see the DNS servers can vary a lot. I am using the "cloudflare" DNS secure server IP addresses.

.
VPNbook_US2_Server.jpg
.
ProtonVPN_US2_Server.jpg
.
vpngate_US_server1.jpg
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
Mintuser998

Re: How to fix dns leaks?

Post by Mintuser998 »

Do you know of a way to STOP dns leaks? Regardless of whether it matters or not. And is it showing the dns connected to prior connecting to the vpn, or is it showing the one after connecting to the vpn?
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: How to fix dns leaks?

Post by phd21 »

Hi Mintuser998

I already gave you all the information and links to various options regarding DNS Leaks in this post and its replies.

My screenshots are showing DNS servers after connecting to the various VPN providers.
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
Mintuser998

Re: How to fix dns leaks?

Post by Mintuser998 »

You're right. I missed it. Can you tell me what this line of code does in a .ovpn file? I can't read terminal code very well.

Code: Select all

setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
User avatar
trytip
Level 14
Level 14
Posts: 5366
Joined: Tue Jul 05, 2016 1:20 pm

Re: How to fix dns leaks?

Post by trytip »

Mintuser998 wrote: Tue Jun 05, 2018 7:23 pm You're right. I missed it. Can you tell me what this line of code does in a .ovpn file? I can't read terminal code very well.

Code: Select all

setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
me neither, all i see is the woman in the red dress :lol:
this just means that usr/bin has all these aliases. when you open a terminal and type a command for a program like gedit for example the terminal will look in these directories for a program called gedit in theory you can place an executable file in any of these folders and the terminal will find it
Image
Mintuser998

Re: How to fix dns leaks?

Post by Mintuser998 »

rbsudo
Level 2
Level 2
Posts: 81
Joined: Sat Jul 15, 2017 10:59 am

Re: How to fix dns leaks?

Post by rbsudo »

Just saw this thread. I use VPN Gate (Open VPN). I searched a long time for a way to stop my vpn from leaking.
I found this and it has worked for me.

1.Open a terminal and enter:
sudo apt-get install openresolv nscd unbound

2. Restart the pc.

3. Activate the VPN.

4. Check for leaks on https://ipleak.net/
Linux Mint 21.2 Cinnamon.. 64-bit
Windows 11
Mintuser998

Re: How to fix dns leaks?

Post by Mintuser998 »

Then I would have to remove resolvconf.
Mintuser998

Re: How to fix dns leaks?

Post by Mintuser998 »

Doesn't any dns showing up mean I have a leak? If so, then the links you've given me won't work to fix it.
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: How to fix dns leaks?

Post by phd21 »

Hi Mintuser998,

After doing some more research on this, and I came across more articles and some posts from "ProtonVPN", here are some more comments.

I just assumed that all Linux Mint editions and versions already have "resolvconf" installed which would help with DNS when using VPN connections.

Code: Select all

sudo apt install resolvconf
But as member "rbsudo" just mentioned and new information I located state that using "openresolve" may work better. I am going to install "openresolve" and experiment with that which will remove "resolvconf", so restart afterward. I am not sure about installing the "nscd" and "unbound" packages because I have not researched those (yet).

Code: Select all

sudo apt install openresolv
openresolv - Roy's Place
* Reasons for using openresolv
https://roy.marples.name/projects/openresolv

FYI-1: Regarding "vpngate" servers: Using the excellent application "vpngate with proxy" I have never had DNS leaks.


Domain name resolution - ArchWiki
https://wiki.archlinux.org/index.php/Do ... resolution


Update on DNS leak with Linux? : ProtonVPN
https://www.reddit.com/r/ProtonVPN/comm ... ith_linux/

FYI-2: ProtonVPN: For Linux users using the superb ProtonVPN provider, they also have a new Linux Client script.
ProtonVPN client tool for Linux - ProtonVPN Support
https://protonvpn.com/support/linux-vpn-tool/

ProtonVPN/protonvpn-cli: protonvpn-cli: ProtonVPN Command-Line Tool for Linux and macOS.
https://github.com/ProtonVPN/protonvpn-cli



Hope this helps ...
Last edited by phd21 on Thu Jun 07, 2018 2:27 pm, edited 1 time in total.
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
rbsudo
Level 2
Level 2
Posts: 81
Joined: Sat Jul 15, 2017 10:59 am

Re: How to fix dns leaks?

Post by rbsudo »

phd21, I don't have any idea what the packages nscd and unbound do. I found the suggestion, saw where a couple of people confirmed it worked for them, and tried it. It worked for me too.

I just did a search on those two packages and found this.

https://linux.die.net/man/8/nscd

https://www.unbound.net/

If that helps, let us know...... it's outside my "pay range." :wink:

Thanks!
Linux Mint 21.2 Cinnamon.. 64-bit
Windows 11
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: How to fix dns leaks?

Post by phd21 »

Hi rbsudo & everyone else,

After exhaustive testing, I think I found out how to stop DNS leaks, at least on my systems with VPN's added (imported) into the Network Manager. This worked with various VPN provider's OpenVPN configuration files (somewhere.ovpn) whether they were TCP or UDP, they recommend UDP.

Steps 1-3 only need to be done once, step 4 editing your VPN provider's VPN configuration files may need to be done for each VPN server location you want to use.

1.) Update your "openvpn" software using their repository.

This link has instructions for updating openVPN software. Linux Mint 19.x already has the updated OpenVPN software.
Is it possible to install the latest openvpn without breaking everything[SOLVED]
viewtopic.php?f=157&t=242583&hilit=openvpn

2.) Install "resolvconf" or "openresolv" (I used the openresolv), make sure you have the "network-manager-openvpn" installed (usually is), install "unbound" ("nscd" did not seem necessary). Recommend openresolv vs resolvconf.

Install all of these with this one console terminal command

Code: Select all

sudo apt install openresolv easy-rsa network-manager-openvpn bind9 unbound 
or

Code: Select all

sudo apt install openresolv easy-rsa network-manager-openvpn
Updated info 02-23-2019: I do not seem to need to install "unbound" or "bind9" packages to stop VPN DNS leaks in Linux Mint 19.x (Ubuntu 18.04+), although I think it is still a good idea to do so. I do need the "bind9-host" because of dependencies with other applications and this is usually installed already anyway. I still need to make sure the OpenVPN server configuration files have the lines below in them per step4.

3.) Then check to make sure the NetworkManager Configuration file has "dnsmasq" disabled with a # in front of that line, save the change, exit the text editor. If there is not a "dnsmasq" entry, do not worry about it, there is nothing to change, go to next step. You can also use your file manager to browse to the file and right-click open as root to edit these files and make changes.

To edit this file in Cinnamon, Mate, Xfce, use the command below. "xed" is the text editor.

Code: Select all

sudo -i xed /etc/NetworkManager/NetworkManager.conf
To edit this file in KDE use the gedit text editor or xed in command below.
Install gedit and xed text editors

Code: Select all

sudo apt install gedit gedit-plugins xed
Edit Network Manager configuration file.

Code: Select all

sudo -i gedit  /etc/NetworkManager/NetworkManager.conf
NetworkManager.conf wrote: [main]
plugins=ifupdown,keyfile,ofono
#dns=dnsmasq

[ifupdown]
managed=false
4.) Check your VPN Providers openVPN configuration files (somewhere.ovpn) to see if these lines are in them before the start of the certificate line <ca>. You can usually right-click a "somewhere.ovpn" file and "open with" any text editor to view or edit them, save it if you make changes. You can click "select all" below and right-click copy to copy this code and then paste into any of your ".ovpn" files, save changes, exit the text editor.

Code: Select all

# To prevent DNS Leaks
block-outside-dns
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
down-pre
Here is an example of a "vpnbook" provider's US server (vpnbook-us1-tcp80.ovpn) file with the changes

Code: Select all

client
dev tun3
proto tcp
remote 198.7.62.204 80
remote us1.vpnbook.com 80
resolv-retry infinite
nobind
persist-key
persist-tun
auth-user-pass
comp-lzo
verb 3
cipher AES-128-CBC
fast-io
pull
route-delay 2
redirect-gateway
# To prevent DNS Leaks
block-outside-dns
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
down-pre

<ca>
-----BEGIN CERTIFICATE-----
MIIDyzCCAzSgAwIBAgIJAKRtpjsIvek1MA0GCSqGSIb3DQEBBQUAMIGgMQswCQYD
VQQGEwJDSDEPMA0GA1UECBMGWnVyaWNoMQ8wDQYDVQQHEwZadXJpY2gxFDASBgNV
BAoTC3ZwbmJvb2suY29tMQswCQYDVQQLEwJJVDEUMBIGA1UEAxMLdnBuYm9vay5j
b20xFDASBgNVBCkTC3ZwbmJvb2suY29tMSAwHgYJKoZIhvcNAQkBFhFhZG1pbkB2
cG5ib29rLmNvbTAeFw0xMzA0MjQwNDA3NDhaFw0yMzA0MjIwNDA3ND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T8JpePI/KNxk7N0A
gm7SAhk379I6hr5NXdBbvTedlb1ULrhWV8lpwZ9HW2k=
-----END RSA PRIVATE KEY-----
</key>
5.) Restart, try connecting to your VPN server(s), or import new VPN server(s) and try it. Verify the VPN is working and check the DNS entries by going to a website like "www.ipleak.net".

* 02-23-2019 * I now also recommend using "DNS over TLS"
How to Protect Your DNS Privacy on Ubuntu 18.04 with DNS over TLS
https://www.linuxbabe.com/ubuntu/ubuntu ... s-over-tls


Hope this helps ...
Last edited by phd21 on Thu Nov 21, 2019 2:50 pm, edited 10 times in total.
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
rbsudo
Level 2
Level 2
Posts: 81
Joined: Sat Jul 15, 2017 10:59 am

Re: How to fix dns leaks?

Post by rbsudo »

Lots of good info on this thread. Should it be pinned for ease of future reference?
Linux Mint 21.2 Cinnamon.. 64-bit
Windows 11
User avatar
majpooper
Level 8
Level 8
Posts: 2084
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: How to fix dns leaks?

Post by majpooper »

Or just install dnscrypt from the Mint repositories
Mintuser998

Re: How to fix dns leaks?

Post by Mintuser998 »

My gosh. It worked, thank you so much. But what does easy-rsa and unbound do? Also what exactly does this do? I'm not sure if I asked this before, but if I did, I didn't get an answer.

Code: Select all

block-outside-dns
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
down-pre
Johnsmith001

Re: [SOLVED]How to fix dns leaks?

Post by Johnsmith001 »

There are many google organic results show some VPN provider's websites tools which are misleading user's highly recommended if you can use https://www.vpninsights.com/ip-leak-test this one
Laugh2
Level 4
Level 4
Posts: 275
Joined: Fri Aug 16, 2013 4:01 am

Re: [SOLVED]How to fix dns leaks?

Post by Laugh2 »

A year or two ago I looked at many VPNs in their default configuration and found that only few protected from DNS leaks. The sites I looked at are listed in viewtopic.php?f=90&t=242032&start=40. At the time I chose PIA as they do protect against DNS links in their default configuration. Things may have changed since then, of course, but I was happy with them at the time.
Last edited by Laugh2 on Sun Aug 12, 2018 12:33 am, edited 1 time in total.
Locked

Return to “Networking”