Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24
How can I determine what DNS server my computer is currently using? My resolv.conf just has my gateway in it, and the gateway router gets the DNS servers automatically from ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2006
    Posts
    97

    How to determine DNS servers


    How can I determine what DNS server my computer is currently using? My resolv.conf just has my gateway in it, and the gateway router gets the DNS servers automatically from my ISP.

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,763
    The resolv.conf does not hold router/gateway info in it.

    If your machine is using DHCP, the dhcp client daemon modified the resolve.conf with this info because that's what it got from your router (IE the router is saying it will forward DNS requests.)

    You can look at your router to see the DNS servers it is getting from your ISP.

  3. #3
    Just Joined!
    Join Date
    Apr 2006
    Posts
    97
    Thanks, you're right, the router lists the servers it uses.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    DIG will also tell you what NS server it is using.
    It is listed at the bottom in the SERVER section.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  6. #5
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,763
    Dig will use whatever nameserver is set in the OS = resolv.conf. So if you've looked at the resolv.conf, you know what name server dig will be using.

  7. #6
    Just Joined!
    Join Date
    Apr 2006
    Posts
    97
    HROAdmin26 is right, the dig command just gives me my gateway address.

  8. #7
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Quote Originally Posted by HROAdmin26 View Post
    Dig will use whatever nameserver is set in the OS = resolv.conf. So if you've looked at the resolv.conf, you know what name server dig will be using.
    Step back and think about your answer for a minute.

    Just because it is listed in your resolv.conf file doesn't mean it is being used. Remember resolv.conf list what servers your system should try to use. Sure it will attempt to use the first listed server but if that server is down then you are no longer using this server.

    You are only assuming the first listed in being used.
    Using DIG/NSLOOKUP you are verifying that it is being used.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  9. #8
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,763
    Quote Originally Posted by Lazydog View Post
    Just because it is listed in your resolv.conf file doesn't mean it is being used.
    Are you suggesting that dig/nslookup will procur some nameserver from some other location than resolv.conf?

    If you look at resolv.conf and have 5 nameservers listed *and your question is you want to know which is currently being queried* then you need to take another step to review nslookup/dig info.

    This thread clearly states that OP's resolv.conf has one entry in it. So that is the only nameserver being used on the client-side.

  10. #9
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Quote Originally Posted by HROAdmin26 View Post
    Are you suggesting that dig/nslookup will procur some nameserver from some other location than resolv.conf?
    Is that what I said? I don't think so. Normally resolv.conf has 2 or more DNS server listed. It is assumed by everyone that the first one listed is the one being used and in most case this is correct. But should that server be down/offline for some reason then the next would be used without the user knowing. To know what server is being used one can look at resolv.conf and then assume which one is being used. But if you want to know for sure then you have to use a program that states what server it used during it's lookup.

    If you look at resolv.conf and have 5 nameservers listed *and your question is you want to know which is currently being queried* then you need to take another step to review nslookup/dig info.
    Quote Originally Posted by bforbes
    How can I determine what DNS server my computer is currently using?
    So the OP's question is properly answered with my answer.

    This thread clearly states that OP's resolv.conf has one entry in it. So that is the only nameserver being used on the client-side.
    This is not the norm for resolv.conf setup making his setup an exception. While your answer is correct for this setup, my answer is 100% correct for all setups. Yes you can use resolv.conf to see what servers are listed and yes you can assume what is being used. But to know for 100% DIG/NSLOOKUP is your option.

    You would be surprised how often I help people with DNS issues only to find out the server they thought they were using was not the server being queried just because they assumed it was the right one.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  11. #10
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,763
    Sure, let's make up "what if" scenarios instead of plainly answering the OP's question.

    The OP *already* knew that his resolv.conf had his router's IP in it. So using dig returned.....the *same* info. And thus added no value to his query.
    So the OP's question is properly answered with my answer.
    The actual answer in this case came from looking at the nameserver values listed in his router.

    The value/usage of dig/nslookup is not in question. It's application in this scenario doesn't help much (if any.) Since the router simply forwards to one of the ISP's nameservers, dig/nslookup won't give him the information he's looking for.

Page 1 of 3 1 2 3 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
  •