What file specifies the DNS servers for hostname resolution on a Linux system?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

The file that specifies the DNS servers for hostname resolution on a Linux system is /etc/resolv.conf. This configuration file is crucial for the system's ability to resolve domain names into IP addresses and vice versa. Within this file, you will typically find lines that begin with nameserver, followed by the IP address of the DNS server to be used for resolving hostnames.

When a program on the Linux system needs to resolve a domain name, it checks the entries in /etc/resolv.conf to determine which DNS servers to query. If multiple nameservers are listed, they are queried in the order they appear in the file.

The other files mentioned serve different purposes. For instance, /etc/nsswitch.conf is responsible for determining the order of the name resolution services, including how the system resolves hostnames and whether it should use files, DNS, or other sources. The /etc/hosts file is primarily used for static hostname to IP address mappings for local resolutions and caching. Meanwhile, /etc/dns.conf is not a standard file in Linux systems for DNS server configuration, and it does not play a role in hostname resolution.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy