117-201 · Question #334
What is incorrect about these entries in /etc/hosts which could be causing host name lookup problems with host2? host1 192.168.1.12 host2 192.168.1.12
The correct answer is C. The fields are out of order. See the full explanation below for the reasoning.
Question
Options
- ATwo host names are using the same IP address.
- BThe server doing the query is on a different subnet.
- CThe fields are out of order.
- Dhost2 is not a fully qualified domain name.
How the community answered
(19 responses)- B11% (2)
- C84% (16)
- D5% (1)
Community Discussion
7C is your answer, and here is the sticky hook to lock it in forever: think "IP then Name" like "I Need" a host, because in /etc/hosts the IP address always comes FIRST, then the hostname. Those entries have the names listed before the numbers, which flips the required order and breaks lookups cold.
Good hook, Fatima, and worth stacking on that you can have multiple hostnames or aliases after that IP on the same line separated by whitespace, so you might see something like "192.168.1.10 server1 server1.local" but the IP-first rule holds no matter how many names follow it.
The fields are backwards, IP belongs first, then the name, so C.
Lock it in with "I before N, just like in DNS PTR zone files, you always PIN the IP first then the Name," and that PIN hook will save you on test day.
I picked D first, but /etc/hosts requires IP before hostname, so C.
I kept staring at option A because having two hostnames share an IP feels wrong, but that is actually valid for aliases and does not cause lookup failures. What clinched C for me is that the /etc/hosts format requires the IP address to come first on each line, and here "host1" and "host2" are sitting in the IP field spot, which means the resolver is trying to look up a hostname where it expects a number.
The format point is solid, but worth naming the exact symptom: when the resolver tries to parse "host1" as an IP it will throw a syntax error and likely skip that line entirely, so both host1 and host2 lose their mappings, not just one of them.