Internal Domain on OpenVPN with Dnsmasq

2

1

I'm trying to get dnsmaq and OpenVPN working together on DigitalOcean. I want to create a VPN that forwards the requests that end with *.local to the droplet and the others to be resolved by Google DNS.

This is my /etc/dnsmasq.conf:

address=/.local/10.8.0.1
resolv-file=/etc/resolv.dnsmasq
listen-address=127.0.0.1
listen-address=10.8.0.1
bind-interfaces
server=8.8.8.8
server=8.8.4.4

This is my /etc/openvpn/server.conf:

dev tun
proto udp
port 1194
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
server 10.8.0.0 255.255.255.0
push "route 10.8.0.0 255.255.255.0"
push "dhcp-option DNS 10.8.0.1"
push "redirect-gateway def1 bypass-dhcp"
ifconfig-pool-persist ipp.txt
keepalive 10 120
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3

In this moment I'm connected to the VPN and it works. I can open every website except the ones that end with *.local (getting ERR_NAME_NOT_RESOLVED).

Edit:

This is my /etc/resolv.conf file:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 2001:4860:4860::8844
nameserver 2001:4860:4860::8888
nameserver 8.8.8.8

After installing dnsmasq it was nameserver 127.0.0.1 but every time I restart the server it returns to that above.

Henrique Dias

Posted 2016-06-16T21:31:56.733

Reputation: 21

Answers

0

After searching a bit, I saw that I hadn't opened the DNS Server port on the firewall. That was the problem.

Henrique Dias

Posted 2016-06-16T21:31:56.733

Reputation: 21