# How to specify a DNS for a specific domaine ?

## doublehp

pre question: in resolv.conf, what's the difference between the fields DOMAINE and SEARCH ? What I know is that on the latter, I can put several domains.

In resolv.conf, how do i specify a specific DNS IP for a specific domaine name ?

Use case: I have 3 VPN to 3 different private networks, each of them having their own local domaine name, and own local DNS. No way to take any of those DNS as primary NAMESERVER server as it would not solve the 2 other ones. So I want a classic resolver for public use, and, then, specify one IP per local domain ...

----------

## Anon-E-moose

man resolv.conf 

That should answer your questions.

Note: Not trying to not answer your question, but the man page tells you everything you can do with resolv.conf

----------

## doublehp

A friends of mine told me to look at nsswitch ... but no clue how it works.

From man resolv.conf, it can't be done; but maybe I did not read properly ?

----------

## doublehp

I mean ... I accept to conf things in /etc, but I refuse to install a resolver service like bind for this purpose.

It's so easy to do it at IP level, it's the definition of a routing table; I Can't believe it's so difficult at DNS level, and would require to install bind.

----------

## ribx

I am looking for a similar solution. A friend of mine uses OSX and has this feature (no clue if it ships with the os or not).

If you want to install a local DNS Server, check dnsmasq. Much easier to configure than bind.

----------

## depontius

I use dnsmasq for this function - it's pretty easy to do and the documentation is quite good.

The "search" line is for when you want to flesh out  a short hostname into a fqdn.  It will tack each domain onto the shortname and attempt to find that FQDN, until one passes or all such attempts fail.

----------

