On Wed, Mar 31, 2021 at 01:43:23PM -0700, David Christensen wrote: > Is there technical documentation that explains how name resolution works in > Linux 4.19.0-16-amd64 and/or Debian 10? (e.g. design and implementation, > userland tools, etc..)
It's not the kernel. At all. The standard name resolution in Debian is done by a modular system called NSS (Name Service Switch). The configuration file for this is /etc/nsswitch.conf. NSS is responsible for several different kinds of name resolution. For hostnames, the line in question is "hosts:". This tells NSS whether to use DNS, NIS, plain files, or other modules, in which order, and whether a failure should abort or continue. nsswitch.conf(5) gethostbyname(3) resolver(3) hosts(5) resolv.conf(5) If you want to test the *standard* name resolution as documented by the pages above, the correct shell tool is getent(1). unicorn:~$ getent hosts www.debian.org 2603:400a:ffff:bb8::801f:3e www.debian.org 2001:4f8:1:c::15 www.debian.org This uses the configuration from nsswitch.conf, so it will consult /etc/hosts and/or DNS, or whatever you've configured your system to use. There are other tools that specifically probe DNS, such as host(1) and dig(1). These bypass nsswitch.conf and go straight to DNS, because they're designed to help an administrator test their DNS configuration. (These are just two of the most common tools for this purpose -- there are many more.) unicorn:~$ host unicorn Host unicorn not found: 3(NXDOMAIN) unicorn:~$ getent hosts unicorn 127.0.1.1 unicorn.wooledge.org unicorn