Verbatim output from my terminal:$ getent hosts example.org2001:500:88:200::10 example.org$ getent ahosts example.org192.0.43.10     STREAM 43-10.any.icann.org192.0.43.10     DGRAM  192.0.43.10     RAW    I thought they were both (at the very least ahosts) supposed to print both IPv4 and IPv6 addresses. Why are these printing different address types?$ uname -srvmpioLinux 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:17:36 UTC 2012 i686 i686 i386 GNU/LinuxEdit: Looks like it might be related to this bug report.
getent hosts prints IPv4, getent ahosts prints IPv6
getent
Both getent hosts and getent ahosts can potentially print both IPv4 and IPv6 addresses, but they decide which address(es) to print differently (that's the point of having two different commands).hosts calls gethostbyname2 (the IPv6-supporting variant of gethostbyname). The behavior is hard-coded: look up an IPv6 address, and if none exists, look up an IPv4 address.ahosts calls getaddrinfo. This function enumerates all protocols for a given name, so it can return both IPv4 and IPv6 addresses in the same call. What it returns is determined by the settings in /etc/gai.conf. Because many applications are still struggling to cope with IPv6, most distributions prefer IPv4 by default and only use IPv6 by explicit request.Some useful reading on ahosts and gai.conf around Stack Exchange:What determines whether the FQDN is interpreted as IPv6 or IPv4?Convince apt-get not to use IPv6 methodWhat is in the output of getent ahosts?Prefer A (IPv4) DNS lookups before AAAA(IPv6) lookupsHow to let the browser prefer IPv6 over IPv4?