Why does dig -6 google.com not work for me?
-4
/-6
tells dig to only use IPv4/IPv6 connectivity to carry your query to the nameserver - it doesn't change whether to query for A
records(IPv4) or AAAA
records(IPv6) if that's what you intended. If dig -4
works but dig -6
doesn't, it just means that your local nameserver can't be reached via IPv6, which can have various reasons. Sure, not having IPv6 connectivity is among them but it's unfortunately also common for some specific home routers to not act as a DNS forwarder on IPv6. They don't strictly need to, since your machine can use IPv4 to query for AAAA
records.
If you want to quickly check if you can reach google.com via IPv6, you could do
ping6 google.com
Yes, that suggests that you do not have IPv6 connectivity.
If you want to obtain an IPv6 address for google rather than using IPv6 to obtain an address for google, you want
dig -t aaaa google.com
Use
ifconfig | grep inet6
to see if you have any global IPv6 addresses (that is, not ::1
and not any link local address beginning fe80::
).