1

Are the user provided search domains from resolv.conf used only for A/AAAA queries ?

Are they used for any other purpose ?

2 Answers 2

1

See man resolv.conf. The local domain (and possibly other domains specified in search) gets appended to a hostname in a query every time it's not a FQDN.

Knowing that, you could easily test whether it works for other RR types or not. You could test that with any existing record like TXT for DKIM selector etc. Let's assume we have SSH fingerprint SSHFP record for someserver.example.com:

nslookup
> set domain=example.com
> set type=SSHFP
> someserver

In this example we actually would get an answer for someserver.example.com SSHFP (instead of handling someserver as a FQDN), demonstrating how it works on any RR type.

Please notice that you can only test this with nslookup that uses resolv.conf as its initial configuration file. The alternative dig always treats all queries as FQDN, i.e.

dig someserver SSHFP

;; QUESTION SECTION:
;someserver.        IN  SSHFP
5
  • 1
    Fwiw, dig has a +search option if you want it to emulate search behaviour (the actual implementation of search is in the OS resolver library, not actually related to what dig does as it is a dns client). I suspect nslookup also does something similar as it, being a dns client in itself just like dig, shouldn't be using the resolver library. Jul 19, 2017 at 15:44
  • Because nslookup takes its initial configuration from the same resolv.conf than the resolver library, it works for this test (that answers the question) out-of-the-box. Thanks for the addition, though, Håkan! Jul 19, 2017 at 15:48
  • I'm not sure this actually proves how the resolver library (and thus regular applications) makes use of the resolv.conf settings, though? Jul 19, 2017 at 16:02
  • True that! I changed the verb to be a bit more precise. Jul 19, 2017 at 16:12
  • I have observed that Windows DNS server does not append the domain name of *nix client's domain mentioned in the resolv.conf file. If I point , in nslookup, to my wifi router then nslookup does append the domain name. Any idea why?
    – Biman Roy
    Feb 6, 2020 at 23:08
1

First of all, it is the OS resolver library which implements the actual search functionality, meaning it's use depends on which OS (or other) libraries are actually in use, and nameserver software does not need to know about it at all.

Ie, when an application looks up a name, calling the standard getaddrinfo, gethostbyname (deprecated), etc functions, the resolver library will make separate lookups for different variations of the specified name as needed.

Now, getaddrinfo and gethostbyname (when these actually end up using DNS at all, the resolver library may be configured to use other sources) specifically looks up address records (A / AAAA), so the question boils down to whether other resolver library code also uses search or if its use is limited to these rather narrow purpose functions.

As there are lots of variables (ie, what DNS lookup functionality is a given application actually using?) the short answer to the question is "it depends".

Having a quick look at other functions provided in the oldschool libc resolv library, an application which uses the res_query / res_nquery functions will NOT search, while an application which uses res_search / res_nsearch will search.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .