I want to use a different dns server for some specific domains that are blocked by the default dns server. And i dont wanna change my default dns server for some reason.

Is there any way of doing this without installing my very own dns server?

I've just learn that this is possible in mac: http://hints.macworld.com/article.php?story=2004062902195410

  • Whatever the answer is, it should involve this file /etc/resolvconf/resolv.conf.d/head . In theory, this file should be scriptable in some way to allow a global DNS and URL specific DNS Dec 27, 2021 at 2:52

4 Answers 4


Take a look at this.

I know this is kind of a late answer but I just tried it and it works.

To summarise it,

  1. Create/edit /etc/NetworkManager/dnsmasq.d/custom-dns
  2. Add these lines so that domain.intra will be resolved by and home.intra will be resolved by We can add as many lines as we want. server=/domain.intra/ server=/home.intra/
  3. Restart network manager by sudo service network-manager restart.

And that's it.

Hope this helps.

  • Well, this should work i guess. but i couldn't make it work on ubuntu 14.04.
    – palindrom
    Mar 25, 2016 at 13:10
  • @palindrom What error did you see?
    – Bruce Sun
    Mar 27, 2016 at 14:35
  • 1
    nothing happens. Seems like that file is never used.
    – palindrom
    Mar 27, 2016 at 17:04
  • Works for me on Xubuntu 17.04. Feb 23, 2017 at 23:09
  • 2
    link is dead: 404 May 27, 2019 at 12:02

There seems to be no DNS routing support in the GNU libc, so the same trick they use in the Mac article you cited will not work on Linux.

Dual DHCP/DNS server is a DNS server that supports DNS routing according to the docs (you can turn the DHCP features off).


you could also add the domains to your /etc/hosts file if the corresponding IPs are relatively static.


I have done this using BIND9 so I can get results from a Google IPv6 whitelisted server while still asking OpenNic servers about their domains. If you are still interested, let me know and I will go back and figure out how it did it, and then edit this answer.

Edit:Now I notice that you didn't want to install your own DNS server! If you are worried about security, you could just make it so that it is firewalled, that way only the computer the DNS server is running on could use it and it would be invisible to the outside that you were running a DNS server.

You must log in to answer this question.

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