A valid /etc/hosts entry must begin with a properly formatted IP address (IPv4 or IPv6), followed by one or more hostnames/aliases separated by whitespace (spaces or tabs). Option A (2001:db8::15 www.example.com www) is valid because it starts with a correctly formatted IPv6 address followed by a hostname and an alias separated by spaces. Option C (203.0.113.15 www.example.com www) is valid because it starts with a correctly formatted IPv4 address followed by a hostname and alias separated by spaces. The other options fail: B places the IP address after the hostnames instead of first; D uses commas instead of whitespace as separators, which is not valid syntax; and E contains an invalid IPv4 address (2003.0.113.15, where the first octet exceeds the 0-255 range) combined with improper comma separation.
Community Discussion