Results 1 to 10 of 12
How should I configure machine to use multiple DNS servers? I think it's related to resolv.conf, but not sure about it?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-08-2009 #1Just Joined!
- Join Date
- Apr 2009
- Posts
- 14
Multiple DNS servers
How should I configure machine to use multiple DNS servers? I think it's related to resolv.conf, but not sure about it?
- 04-08-2009 #2Just Joined!
- Join Date
- Sep 2007
- Location
- Lafayette, IN
- Posts
- 83
You just need to list multiple nameservers in your /etc/resolv.conf file. See the resolv.conf man page (man 5 resolv.conf) for more information on configuring the resolv.conf file.
- 04-08-2009 #3Just Joined!
- Join Date
- Apr 2009
- Posts
- 14
Simply adding multiple nameserver options to the file doesn't work (and afaik it shouldn't), because I need to use both nameservers at the time.
- 04-08-2009 #4Just Joined!
- Join Date
- Sep 2007
- Location
- Lafayette, IN
- Posts
- 83
Ah, that's a little different. I'm not entirely sure that DNS works that way. Why do you need to use both servers simultaneously?
- 04-08-2009 #5Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
If you are using Network Manager, your resolv.conf is automatically updated by it. You can add entries to resolv.conf to test them but they are overwritten as Network Manager sees fit, including at boot time. If you want to override the ones Network Manager is providing you can have them added to /etc/dhcp3/dhclient.conf. Add an entry to prepend your preferred servers
You can add them as seperate lines for each server, but remember as it is a prepend each new line will be put the top of the list in resolv.confCode:prepend domain-name-servers 208.67.220.220 208.67.222.222;
Another thing to bear in mind is that if you are using a router this is not necessary at client machine level. You can logon to your router and change the default name servers there and let that information propagate out to all of your client machines via dhcp. That's the preferred method
- 04-08-2009 #6Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
That's not how DNS works. You should have one primary server and then as many secondary servers as you want. All requests are forwarded to your primary server and if an entry is not found it will pass through onto the next available server.
If you have conflicting entries on your servers, the entry on the primary server will trump as it returned an entry thus negating the need to search further.
- 04-08-2009 #7Just Joined!
- Join Date
- Apr 2009
- Posts
- 14
@bigtomrodney:
No, I'm not using dhcp or Network Manager, but thanks for interest
@Ben Cotton:
I need the server to "see" both local (in the local network) and global domain names.
EDIT:
Then how can I define a secondary ns?
- 04-08-2009 #8Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
- 04-08-2009 #9Just Joined!
- Join Date
- Sep 2007
- Location
- Lafayette, IN
- Posts
- 83
Okay, now I think I see what you're getting at. You want to run a name server for your local hosts but also resolve outside hosts. Fortunately, most DNS servers are configured to do exactly that. You'll need to specify "forwarders", see bind 9 sample file - /etc/named.conf - Deployment example for an example.
You might also want to check out this book: DNS and BIND | O'Reilly Media It will tell you all you ever wanted to know about DNS.
- 04-10-2009 #10Just Joined!
- Join Date
- Apr 2009
- Posts
- 14
Thanks, it seems to be exactly what I'm looking for
I'll try to configure it and eventually post my problems here :P


Reply With Quote

