Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have several Ubuntu servers. Two of them are working as DNS servers. One of my name servers (let's call it DNS1) went down for maintenance. I sill had another DNS server running (DNS2).

All other servers are configured to use the nameservers as follows

/etc/resolv.conf :

nameserver DNS1
nameserver DNS2

I can still resolve DNS names using the DNS2 server, but the name resolution takes a long time. It is clear to me that any given server is first trying to access DNS1, and then it is trying DNS2 after failure.

I tried to swap the two lines. The name resolution became too fast.

I am wondering if there is a way to dynamically change the resolv.conf file based on the state of the configured nameservers. Of course, I can write a shell script myself to do the job. But I prefer to find a better way if there is one.

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

No a direct solution but you can smooth things a little by adding options to your resolv.conf for instance :

nameserver DNS1
nameserver DNS2

options rotate
options timeout:2
options attempts:1

the default for timeout is 5 seconds, and default value for attempts is 2.

share|improve this answer
    
This was really useful. Thanks! –  Khaled Dec 12 '10 at 12:09
    
Glad I could help. –  Casual Coder Dec 12 '10 at 12:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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