LX0-104 · Question #675
Which of the following is a correct entry in the /etc/hosts file?
The correct answer is D. 127.0.0.1. A correct entry in the /etc/hosts file typically maps an IP address to a hostname, with 127.0.0.1 being the standard loopback IP address for localhost. The /etc/hosts file is used for local DNS resolution before querying external DNS servers.
Question
Options
- Alocalhost
- Blocalhost.localdomain
- Clocalhost
- D127.0.0.1
- Elocalhost.localdomain
How the community answered
(28 responses)- B4% (1)
- C4% (1)
- D93% (26)
Why each option
A correct entry in the /etc/hosts file typically maps an IP address to a hostname, with 127.0.0.1 being the standard loopback IP address for `localhost`. The /etc/hosts file is used for local DNS resolution before querying external DNS servers.
"localhost" is a hostname, not a complete /etc/hosts entry, which requires an IP address mapping.
"localhost.localdomain" is a hostname, not a complete /etc/hosts entry, which requires an IP address mapping.
"localhost" is a hostname, not a complete /etc/hosts entry, which requires an IP address mapping.
The /etc/hosts file maps IP addresses to hostnames, where `127.0.0.1` is the standard loopback IP address. A complete entry would include this IP followed by hostnames like `localhost` or `localhost.localdomain`, thus `127.0.0.1` is the essential IP component of such an entry.
"localhost.localdomain" is a hostname, not a complete /etc/hosts entry, which requires an IP address mapping.
Concept tested: /etc/hosts file format and loopback IP
Source: https://man7.org/linux/man-pages/man5/hosts.5.html
Topics
Community Discussion
No community discussion yet for this question.