DNS resolution
DNS maps names to records rather than simply mapping every name to one IP address. A and AAAA hold IPv4 and IPv6 addresses, CNAME aliases another name, and other record types support other services. Resolvers cache answers according to TTL and related rules; authoritative servers publish zone data. getent hosts localhost uses the system name-resolution path; dig example.com A, when installed, explicitly queries DNS and reveals answer records and TTL values. Distinguishing local resolution from authoritative DNS prevents debugging the wrong layer when a cached answer, hosts-file override or nonexistent name changes the destination used by a client. Assuming dig and an application always use identical resolution paths overlooks local configuration and caches; compare the actual application lookup with direct DNS evidence before drawing conclusions.
getent hosts localhost uses the system name-resolution path; dig example.com A, when installed, explicitly queries DNS and reveals answer records and TTL values.
Distinguishing local resolution from authoritative DNS prevents debugging the wrong layer when a cached answer, hosts-file override or nonexistent name changes the destination used by a client.
Assuming dig and an application always use identical resolution paths overlooks local configuration and caches; compare the actual application lookup with direct DNS evidence before drawing conclusions.