CompTIA Linux+ Powered by LPI (LX0-104) — Question 40
Which of the following is a correct entry in the /etc/hosts file?
Answer options
- A. localhost 127.0.0.1 localhost.localdomain
- B. localhost.localdomain localhost 127.0.0.1
- C. localhost localhost.localdomain 127.0.0.1
- D. 127.0.0.1 localhost.localdomain localhost
- E. localhost.localdomain 127.0.0.1 localhost
Correct answer: D
Explanation
Option D is correct as it correctly maps the IP address 127.0.0.1 to the hostname localhost and its associated domain. The other options either misplace the order of the entries or use incorrect formatting, which does not conform to the typical structure required in the /etc/hosts file.