Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm in a strange situation.

  • At work, I've set up OpenVPN + DNSMasq DNS server.
  • is the internal IP of the VPN server.
  • is the internal IP of the DNS server.

If I connect to the VPN server from external network, it all works fine - I can ping and ssh in to the local machines by their ip addresses.

However, for some reason, I cannot access the DNS service. I can ssh into So I tried nslookup HOSTNAME, but I only get ;; connection timed out; no servers could be reached. This occurs both for internal and external domain names.

While OpenVPN is running, If I ssh into any of the machine in local area network, and run nslookup HOSTNAME, it works as the intended. Morever, I can even telnet to the port 53 of the machine10.0.0.200.

To debug the problem, I tried few more things. I gave an external IP to the DNS server,, say, In external network, I can run nslookup HOSTNAME, the command executes as expected - it resolves both internal and external domain names.

However, when I start Openvpn client in the client machine, and run nslookup HOSTNAME, it did not execute with the same connection timed out; error message.

traceroute to (, 30 hops max, 60 byte packets
 1 (  25.705 ms  25.714 ms  25.790 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * (  25.742 ms
12 (  25.658 ms  33.069 ms  33.067 ms
13 (  33.075 ms  33.009 ms  37.902 ms
14 (  40.420 ms  40.332 ms  40.364 ms
15  * * *
16 ...(and go on) is the gateway of the virtual interface created by OpenVPN.

At that point, I also noticed that Wed May 18 22:32:44 2011 /sbin/route add -net netmask gw metric 101 was in the startup message of of the openvpn client.

So, I suspect that routing DNS query traffic over OpenVPN is somehow causing the problem. However, I do not know

This is a lot of fragmented information, with a lot of more uncertainties. To summarize:

  • The problem: I cannot properly access the DNS server in local network via VPN, even though everything else seem to work fine.
  • I suspect that routing DNS traffic via OpenVPN is a problem, but I am not sure, and I do not know the solution for it.
share|improve this question

I believe the problem you have is with the DNSMasq config since you keep getting the ;; connection timed out; no servers could be reached error message.

I encountered the same problem while configuring my DD-WRT with OpenVPN and fixed it by adding:


to my dnsmasq.conf (Services | Additional DNSMasq Options from DD-WRT HTTP interface) [1]

You can then push the proper DNS server to clients by adding the following:

push "dhcp-options DNS 10.x.x.x"

to the OpenVPN config [2], however this only works 'out of the box' on windows [3]. On Ubuntu clients I just manually set my internal DNS server instead of writing scripts to parse the foreign_option_n parameter.

  2. OpenVPN and DNS. How to?
share|improve this answer
interface=tun0 did it for me. – JorgeeFG Jan 2 '15 at 14:37

It's most helpful if you post your /etc/openvpn/server.conf config file. In particular, check that you are pushing routes and dns servers to the clients:

# give clients access to the whole work network, not just the server.
push "route"
# tell clients to use your internal dns server
push "dhcp-option DNS"
push "dhcp-option DOMAIN"

See my openvpn setup howto for more details. Also check that your dns server is configured to allow access from the remote clients, and that the firewall on the vpn server is allowing dns traffic to pass.

share|improve this answer
I'm using OpenVPN AS right now, and I don't think I have the file /etc/openvpn/server.conf - is there easy way to see / generate server.conf in this case? – Jeeyoung Kim May 19 '11 at 7:58
I assume it's got the conf file in there somewhere. If you're on a rhel type of system run 'rpm -qa' to list installed packages, and 'rpm -ql xxx' on the opernserver as package to get a list of installed files. If you poke around in there you should find the directory where the openserver config file lives. – Phil Hollenback May 19 '11 at 8:09

You need to configure your VPN client machine to use as its resolver upon connecting to the VPN.

You could try this manually by editing the /etc/resolv.conf (or your OS equivalent) and issuing DNS queries.

To further troubleshoot, please provide:

  • OS and DNS configuration for the VPN client
  • DNS configuration for your DNS server at (recursive, authoritative, firewall, default route, etc)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.