How to allow OpenVPN (W10) client to use DNS server (BIND9) that resides on (Ubuntu 16.04) OpenVPN server?

grigory

Member
Jan 31, 2016
41
0
66
Hello!
I have Ubuntu 16.04 (Desktop Edition) with OpenVPN server and BIND9 installed. I used a script when I installed OpenVPN. My OpenVPN client is a W10 netbook with 4G USB modem.
When I choose to use Google DNS during OpenVPN installation then I can surf the Internet via OpenVPN just fine (on my OpenVPN client W10 machine). But if I choose to use a current DNS settings (ie. my own BIND9 server), then I can connect from client to server, but DNS doesn't work. I know that I must edit config file of OpenVPN server server.conf AND to also edit client.ovpn client's OpenVPN file too. And I don't know exactly whether my DNS server (BIND9) is properly configured to play this kind of role.
When I go to W10's CMD and do ipconfig /all I do see DNS server with a correct IP of my BIND9 (it's a public IP of my Ubuntu machine, actually). Nevertheless, DNS doesn't work on a client machine and I couldn't find a complete step-by-step manual how to enable this scheme.
 

grigory

Member
Jan 31, 2016
41
0
66
I added this line to OpenVPN config файл:

push "dhcp-option DNS 10.8.0.1"

And DNS on the client side still doesn't work.
When I tried to nslookup cnn.com in W10 terminal, then I saw:
*** Unknown can't find cnn.com: Query refused
When I check two log files of BIND9 I see this lines:

In BIND9's quiry log file I do see these lines:

17-Sep-2019 00:17:36.679 queries: info: client 10.8.0.2#64118 (1.0.8.10.in-addr.arpa): query: 1.0.8.10.in-addr.arpa IN PTR + (10.8.0.1)
17-Sep-2019 00:17:36.704 queries: info: client 10.8.0.2#64119 (cnn.com): query: cnn.com IN A + (10.8.0.1)
17-Sep-2019 00:17:36.737 queries: info: client 10.8.0.2#64120 (cnn.com): query: cnn.com IN AAAA + (10.8.0.1)
17-Sep-2019 00:17:36.785 queries: info: client 10.8.0.2#64121 (cnn.com): query: cnn.com IN A + (10.8.0.1)
17-Sep-2019 00:17:36.804 queries: info: client 10.8.0.2#64122 (cnn.com): query: cnn.com IN AAAA + (10.8.0.1)

It's after I tried to nslookup CNN site
And when I in the browser try to open say BBC site I see those lines:

17-Sep-2019 00:21:47.325 queries: info: client 10.8.0.2#56585 (bbc.co.uk): query: bbc.co.uk IN A + (10.8.0.1)
17-Sep-2019 00:21:47.355 queries: info: client 10.8.0.2#56585 (bbc.co.uk): query: bbc.co.uk IN A + (10.8.0.1)
 

grigory

Member
Jan 31, 2016
41
0
66
And BTW in BIND9's debug log file I see these lines:

17-Sep-2019 00:21:37.285 security: info: client 10.8.0.2#51516 (bbc.co.uk): query (cache) 'bbc.co.uk/A/IN' denied
17-Sep-2019 00:21:37.290 security: info: client 10.8.0.2#51516 (bbc.co.uk): query (cache) 'bbc.co.uk/A/IN' denied
17-Sep-2019 00:21:47.325 security: info: client 10.8.0.2#56585 (bbc.co.uk): query (cache) 'bbc.co.uk/A/IN' denied
17-Sep-2019 00:21:47.355 security: info: client 10.8.0.2#56585 (bbc.co.uk): query (cache) 'bbc.co.uk/A/IN' denied

AND

7-Sep-2019 00:17:20.944 security: info: client 10.8.0.2#64114 (cnn.com): query (cache) 'cnn.com/A/IN' denied
17-Sep-2019 00:17:20.976 security: info: client 10.8.0.2#64115 (cnn.com): query (cache) 'cnn.com/AAAA/IN' denied
 

mxnerd

Diamond Member
Jul 6, 2007
6,799
1,101
126
What if you add the following statements?

push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 1.1.1.1"

or edit /etc/bind/named.conf.options

Code:
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

        // forwarders {
        //      0.0.0.0;
        // };

So it becomes

Code:
forwarders {

              8.8.8.8;
              1.1.1.1;

         };
 
Last edited:

Red Squirrel

No Lifer
May 24, 2003
67,651
12,252
126
www.anyf.ca
On the DNS server you may need to add a rule to allow the VPN client IP to do name resolution. In /var/named/chroot/etc/named.conf find this block:
(may have different options)

Code:
options {
    listen-on port 53 { 127.0.0.1; 10.1.1.3; };
    listen-on-v6 port 53 { ::1; };
    directory     "/var/named";
    dump-file     "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
    allow-query     { localhost; any; };
    recursion yes;

    dnssec-enable yes;
    dnssec-validation yes;
    dnssec-lookaside auto;

    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";
};


Find the option:
Code:
allow-query     { localhost; any; };

In the { } brackets it may only be allowing localhost. You can either put "any" (if this is a local DNS) or IP range of the VPN client (the IPs that get assigned to clients). I think you can use CIDR notation, ex: 10.10.1.0/24.

Of course, also double check that DNS queries are working locally on DNS server as well as on the VPN server too just to rule that out.
 

grigory

Member
Jan 31, 2016
41
0
66
Red Squirrel,
Thanks. But I actually found the way after playing around with file etc/bind/named.conf.options. What I did was this...
Added this line to my .ovpn file on W10 client machine:

dhcp-option DNS 10.8.0.1

And in etc/bind/named.conf.options I've added before "options" this:

acl my_net { 10.0.0.0/8; };

And then added my_net into allow-recursion
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |