Is there a way to define a dns server for a specific domain? I'm setting up a develop machine with an amp stack and i want to redirect all urls with a specific domain (i.e. project.dev) to I've done this on OSX with dnsmasq configured in this way:

# /etc/dnsmasq.conf


and adding a dev file in /etc/resolver with this content

# /etc/resolver/dev

port 35353

but this in arclinux with dhcpd doesn't work.

I've tested dnsmasq with dig test.dev@ -p 35353 and it works (the address returned is so the problem is the resolver.

I've also tried either put into /etc/resov.conf.head this:

# /etc/resolv.conf.head
port 35353

and configure dnsmasq with the default 53 port without luck.

This is my /etc/resolv.conf

# /etc/resolv.conf
  • if you are asking if you can use one DNS server for queries based on the name xyz.com and another server based on the name abc.com, no not in any OS I've ever worked with. DNS servers are tied to an interface, at the same level that IP address and Default Gateway are defined, so in order to do that you need an additional interface. – Frank Thomas Mar 3 '15 at 17:41
  • 2
    Note that you can run a local DNS server though, and forward NX responses for lookup by another DNS server, just like you do with DNSMasq. – Frank Thomas Mar 3 '15 at 17:50
  • ok so how can I configure arch to use my local host for DNS queries as first and then forward the query if it doesn't ends with .dev? – Gigitsu Mar 3 '15 at 17:51
  • thats what you can't do. there is no selectivity to it. – Frank Thomas Mar 3 '15 at 17:53

You have two options here; either you need to configure the DNS server at to resolve ".dev" to, or run dnsmasq and route all your requests through that, much as you did with OSX previously.

The multiple nameservers in resolv.conf are tried in order - that is, if the top one is unreachable, the second will be used. Getting an NXDOMAIN or SRVFAIL response from the top server does not count as a failure for this case.

I have the same config set up here, though now I have control of the remote DNS server (using unbound) I was able to cast ".local" to resolve to Previously I did this with dnsmasq - the only thing you really need to do is to tell dnsmasq three things;

no-resolv: Don't look for upstream nameserver in the resolv.conf file. Since that's just going to contain, that'll give you a recursion headache.

server= or wherever your remote DNS server is - where should dnsmasq look to if it can't find the answer to your question in its local config? You could also use something like '' here (Google's public DNS service).

address/.dev/ - Match any requests for "*.dev" to "".

With that, and the nameserver= directive in resolv.conf.head, you should be set.

  • 1
    The idea of configure the DNS server at is great, but not suitable in my case because i move through multiple networks. At the end I've used dnsmasq to respond at every dns query and forward all not .dev query. In this way I've obtained a dns cache too. The problem were the port property in /etc/resov.conf.head that is not standard and works only on osx. Thank you very much for answer! – Gigitsu Mar 11 '15 at 12:58
  • Yeah - it's not possible for everyone, because of course some people also don't have access to configure their DNS server in work, or it might be just a router or some thing which can't be configured as easily. I mentioned it just because it's possible to achieve this in that way, and in some cases it's an easier solution, especially if as in our case you want to make that alias available to multiple users, or on different platforms (that works on windows too, for instance). Whatever works! – Xyon Mar 16 '15 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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