On 2023-03-27 13:48, Richmond wrote:
I have configured an ipv6 tunnel. If I visit this site:
http://ip6.me/
The "normal" test shows my ipv4 address, and the:
http://ip6only.me/
shows the ipv6 address.
However if I switch my DNS from opendns to the one provided by my ISP
and then run the "normal" test it shows the ipv6.
The note says:
(preference depends on your OS/client)
So how is the preference determined? It seems to be determined by the
DNS, but why or how do I tell for example with host -v?
That's weird… It should not be reslover-dependant unless your default
resolver either don't support IPv6 which seems not to be the case, or
(wrongfully) prioritize IPv4 unless the resolved name has IPv6 only?
In "normal" context, it's not determined by the DNS resolver, but it can
be limited by the DNS resolver, of course if the resolver answers for
IPv4 only (A record).
If the resolver can return both IPv4 and IPv6 records, and both your OS
and application supports it, which debian does and most half-decent web
browser do, then the OS or application config decides whether enable
IPv6 or not. If IPv6 is enabled, it should be prioritized and IPv4 is
used as fallback if IPv6 fails (e.g, when connecting to an IPv4 only
server, or using IPv4 only resolvers, if those still exist).
For debian and multiple other distros, it depends on systemd settings.
On debian, IPv6 can be disabled in /etc/sysctl.conf, as far as I know it
is enabled by default, unless need to add line(s) like
net.ipv6.conf.all.disable_ipv6 = 1
To /etc/sysctl.conf, then reload the file with sysctl command, or
reboot. Note that "=1" mean disable, NOT enable, since the option names
are in the negative form.
PS: For Non-debian-like systemd-based distros, espcially RHEL, Fedora
and so on have a different path for these options. I don't remember the
exact but there's no /etc/sysctl.conf
And For non-systemd distros, it is usually a bootloader option. for
GRUB, it's the "ipv6.disable=1" parameter to the
"GRUB_CMDLINE_LINUX_DEFAULT" in "/etc/default/grub" file