Configuring /etc/hosts and DNS resolving
Name resolution is an essential part of any operating system, specifically its networking stack. Generally speaking, operating systems have multiple different ways of making DNS queries – usually, it involves some kind of hosts
file, caches, and – of course – network interface configuration. Let's go through the configuration capabilities of /etc/hosts
and see how that fits in the grand scheme of name resolution.
Getting ready
Keep the CLI1 virtual machine powered on and let's discuss how to work with name resolution in general, using /etc/hosts
(a file that we can fill with hostnames and IP addresses for local resolving) and /etc/resolv.conf
(a file that determines which DNS servers are being used for network resolving, and which domain is the Linux server a part of) as integral parts of that process. When editing /etc/hosts
or /etc/resolv.conf
, we have to be logged in as root or use sudo
, as this is a system...