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?
Summary:
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
ping4
is an alias forping -4
andping6
is an alias forping -6
. This controls which Socket families to use, but also what hint to specify forgetaddrinfo()
. If you useping
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).ping
are you using? Are you sure you used the same version ofping
both times?ping
in the standard repository.