I use a VPN to connect my development machine to my school's CS dept. The development machine is Ubuntu as we do C programming in Unix. I used vpnc to do that. The school uses some DNS entries that only resolve on their DNS servers, i.e., internalserver.csdept.school.edu

I am normally attached to the VPN whenever booted for convenience. However I noticed the other day that when I disconnect the VPN all my DNS queries fail. This obviously means that vpnc set up the school's DNS to be used. However I'd rather not use their DNS all the time (tracking and privacy and whatnot). Is there a way I can restore my ISP's DNS and then if the lookup fails, have it use my school's DNS?

2 Answers 2


vpnc hacks /etc/resolv.conf. Here are several links that deal with this issue:

  1. Ubuntu Jaunty vpnc setup
  2. CentOS vpnc setup

You might be also able to solve this problems with the resolvconf package.


Not really, because resolution through your ISP's DNS will not "fail". It will return "no result" which is not a failure. It is technically possibly to setup a convoluted situation on your PC where you could direct various queries to different DNS servers based on what domain you're tying to lookup; but I'd highly advise against doing something like that as it's likely to cause more problems than it's worth.

  • Hmmm, this is troubling. (Not that I'm try to hide anything from my university Whistles nonchalantly). What, in Linux, handles DNS lookups? Is it possible to write a short program to wrap it that would use a regex to match "^.*\.school\.edu$" and treat it specially?
    – Huckle
    Apr 16, 2012 at 2:32
  • 2
    dnsmasq can be configured to resolve different domains form different servers quite easily.
    – BillThor
    Apr 16, 2012 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .