Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
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.
  1. #1
    Just 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?

  2. #2
    Just 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.

  3. #3
    Just 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.

  4. #4
    Just 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?

  5. #5
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,132
    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
    Code:
    prepend domain-name-servers 208.67.220.220 208.67.222.222;
    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.conf

    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

  6. #6
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,132
    Quote Originally Posted by Beju View Post
    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.
    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.

  7. #7
    Just 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?

  8. #8
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,132
    Quote Originally Posted by Beju View Post
    Then how can I define a secondary ns?
    Have you added both entries to /etc/resolv.conf ?
    Code:
    nameserver 208.67.220.220
    nameserver 208.67.222.222

  9. #9
    Just Joined!
    Join Date
    Sep 2007
    Location
    Lafayette, IN
    Posts
    83
    Quote Originally Posted by Beju View Post
    I need the server to "see" both local (in the local network) and global domain names.
    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.

  10. #10
    Just 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

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •