I do have a Debian server running a BIND9 DNS server. In my zone file, I have several hosts that are equally reachable via IPv4 and IPv6 and they do have their respective A or AAAA records.

Now I wanted to add an IPv6-only host to my zone, this is a computer running in my home network. This computer has an IPv6 address that is reachable from the internet / my DNS server machine (I can ping6 the address directly). However, it does not have an IPv4 address (because it is NATted behind my router etc.).

I thought that it would not matter and I can simply add a AAAA record for this host with the IPv6 address and be able to ping it.

The thing is that I can only ping this machine when using ping6, the standard ping command gives me unknown host. This is somehwat understandable, but I wonder why the normal ping has no problems with pinging one of the hosts that have an IPv4 and and IPv6 record - in this case, the normal ping resolves to the IPv6 address.

Is there an explanation for that and what can I do to change this behaviour?


Host has A + AAAA record: ping resolves to IPv6 address, ping6 resolves IPv6 address

Host has AAAA record only: ping does not resolve IPv6 address, ping6 resolves IPv6 address

  • 1
    The ping from iputils Support both -4 and -6. Whereas ping4 is an alias for ping -4 and ping6 is an alias for ping -6. This controls which Socket families to use, but also what hint to specify for getaddrinfo(). If you use ping with no address family option it will use AF_UNSPEC hint. So technically the unspec mode should resolve all address types, but this might depend on the resolver. The code looks like it can handle concurrent address families (it opens two sockets if supported and iterates all addresses).
    – eckes
    Commented Apr 18, 2018 at 20:06
  • I cannot reproduce what you are reporting. Which version of ping are you using? Are you sure you used the same version of ping both times?
    – kasperd
    Commented Apr 18, 2018 at 20:57
  • @kasperd: Sorry, I wasn't very clear on that point: I've tested with ping and ping6 on a decent Ubuntu system as well as on a Windows 10 system (both systems with both stacks).
    – Rob
    Commented Apr 19, 2018 at 8:30
  • @Robert Ubuntu has at least 2 different versions of ping in the standard repository.
    – kasperd
    Commented Apr 19, 2018 at 20:21

1 Answer 1


ping only requests IPv4 addresses (which means it ONLY queries for A records) and ping6 only requests IPv6 addresses (and queries only AAAA records).

So for dual stack system, which has both address types exposed in DNS both commands work as they can see appropriate record types in DNS. In a case of IPv6 only host A record is missing and hence ping bails out.

The part you've got wrong is the assumption that ping can resolve using AAAA records - it cannot. You can use network sniffer (like wireshark) to see exactly what gets send to resolver. ICMP and ICMPv6 are different protocols and are tightly coupled with IPv4 and IPv6 respectively and CANNOT be interchanged.

  • Thanks, but at least on my Windows 10 machine the standard ping (without -4 or -6 added) seems to evaluate A and AAAA records and then uses the IPv6 address, if available, and pings it successfully. This is what made me wonder: if both address types are available, ping actually prefers and uses IPv6, but if only v6 is available, it fails.
    – Rob
    Commented Apr 19, 2018 at 8:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .