Take the 2-minute tour ×

I can add DNS servers to resolv.conf and that works fine.

But is it possible for me to call a different DNS server based on the domain trying to be resolved?

For example:

use for everything
except use for "mycompany.net"

Edit: adding more detail.

I am trying to VPN into my company's server. Everything almost works great following this guide: http://www.cyberciti.biz/tips/howto-configure-ubuntu-fedora-linux-pptp-client.html

DNS resolution doesn't work for me. The article suggests modifying resolv.conf with the DNS servers.

When I have the first nameserver in the list as my own router, resolution of names on the VPN doesn't work. When I have the first nameserver as my company's router, resolution of names on the Internet doesn't work.

share|improve this question

2 Answers 2

up vote 6 down vote accepted

Not directly.

But you could run your own local DNS server which is configured with details to serve for mycompany.net and forward requests for other domains to your normal servers.

I may not be reading your question right - can you go into more detail about the problem that what you are asking for would solve?

share|improve this answer
Sorry, I didn't word it very well. Let me add more details to the question. –  user3875 Sep 9 '09 at 23:39
That works! Thank you. Now that I added more detail, is there a simpler way? I'm just curious because this works great. –  user3875 Sep 9 '09 at 23:44
If your company's DNS server was configured to allow you do perform recursive queries when accessing via the VPN, then you would not need the local server yourself. You could also try the hosts file approach but that can be a hassle to maintain so isn't recommended. –  David Spillett Sep 10 '09 at 19:05

You could also put the data for your company's network into your /etc/hosts file. That way you don't have to run a DNS server on your own computer.

share|improve this answer
That would be a poor solution because this information will quickly become stale. Never put in a static file data which is outside of your control. –  bortzmeyer Sep 10 '09 at 7:51
How practical that is of course depends on the size of his company's network (and the number of computers he needs access to there). In some cases that's just 1 or 2 servers. –  Kim Sep 10 '09 at 11:18

Your Answer


