How do I figure out what is answering a DNS resolution call?
1
vote
2
answers
986
views
Let's say I have inside of my hosts file an entry for
foobar
, how do I find out if that file is used or if a remote DNS is answering the resolution for foobar
?
Do any of the basic utilities give back that information?
dig +trace
isn't showing me what I want to know
dig +trace localhost
; > DiG 9.10.3-P4-Ubuntu > +trace localhost
;; global options: +cmd
;; Received 28 bytes from 127.0.0.53#53(127.0.0.53) in 0 ms
dig +trace google.com
; > DiG 9.10.3-P4-Ubuntu > +trace google.com
;; global options: +cmd
;; Received 28 bytes from 127.0.0.53#53(127.0.0.53) in 0 ms
I would expect it to tell me that the lookup is resolving to hosts
for localhost
and my dns server (whichever one) for google.com
. If I make a call internally using [getaddrinfo(3)
](https://en.wikipedia.org/wiki/Getaddrinfo) is it hitting the hosts file or the upstream dns server when resolving localhost
.
Asked by Evan Carroll
(34663 rep)
May 16, 2017, 06:27 PM
Last activity: Apr 7, 2025, 12:44 PM
Last activity: Apr 7, 2025, 12:44 PM