# [solved] multiple dns nameservers

## mistake25

hi,

i run my own dns for my personal purposes, and i want to use it.

in /etc/resolv.conf i have two lines:

nameserver xxx.xxx.xxx.xxx (ip of public dns)

nameserver yyy.yyy.yyy.yyy (ip of my own dns)

and when i try to ping adress that is provided by my own dns i will get error unkown host, if i set my dns as first i'm able to ping that url and also i'm able to ping any other public url, but i don't want to have my own dn as primary server. what can i do to make it work?

thanksLast edited by mistake25 on Wed Sep 01, 2010 8:43 pm; edited 2 times in total

----------

## eccerr0r

I run my own caching DNS server using bind, and only use it in my resolv.conf as primary/only ... not sure what the problem is?

It also has local entries along with forwarding the non local machines upstream...

----------

## mistake25

if i set it as primary, everything works fine, but if i set it as secondary, it fails, and i want to use it as secondary

----------

## doctork

 *mistake25 wrote:*   

> if i set it as primary, everything works fine, but if i set it as secondary, it fails, and i want to use it as secondary

 I guess my answer would be, you can't.  The resolver library will attempt to reach the first server in resolv.conf and not try the second unless the first server is unavailable.  If the first responds with "unknown host", the resolver is satisfied, and tells you so.  The setup described by eccerr0r above works well.  I've been using similar for years.  It has the added advantage of caching queries and thus speeding up operations.

--

doc

----------

## Princess Nell

Let me see if I understand this correctly: your own DNS server is authoritative for your own zone, and you wish to resolve hosts in that zone. The zone is private and not available on public DNS.

If this is the case, your setup is not correct. You want only your own server in resolv.conf. This way, all requests will go to your own server, it will resolve hosts from the private zone itself, and pass queries for other hosts up or answer them from the cache.

You want to add a secondary server for resiliency and also add it to resolv.conf, or your dhcp server if you have dynamic clients.

A more secure setup would see authoritative and recursive server on separate machines.

----------

## mistake25

ok it was my fault, i tought that when primary dns server reports unknown host, then it is asked secondary dns.

thank you for explaination

----------

