I'm using a IPv4 + IPv6 on a server (#1).
Sometimes the IPv4 address is mapped to another server (#2), so #1 isn't accessible via IPv4, but remains accessible via IPv6.
In this case IPv6 dns lookups won't work.
$ ping6 mirror.ipv6.hetzner.de
unknown host
If I disable the IPv4 address everything works fine.
$ ping6 mirror.ipv6.hetzner.de
PING mirror.ipv6.hetzner.de(2a01:4f8:0:a101::1:1) 56 data bytes
64 bytes from 2a01:4f8:0:a101::1:1: icmp_seq=1 ttl=60 time=0.469 ms
How is this possible? The IPv6 network should serve as a fallback if the IPv4 address is mapped to another server. But if I can't resolve any hostnames, i can't really work with it.
Are there any possibilities to make IPv6 dns work nevertheless IPv4 is available or not?
Edit:
/etc/resolv.conf
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 213.133.99.99
nameserver 213.133.100.100
nameserver 213.133.98.98
nameserver 2a01:4f8:0:a0a1::add:1010
nameserver 2a01:4f8:0:a102::add:9999
nameserver 2a01:4f8:0:a111::add:9898
Routing:
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 5.9.61.167 0.0.0.0 UG 100 0 0 eth0
5.9.61.167 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
$ route -6
Kernel IPv6 routing table
Destination Next Hop Flag Met Ref Use If
2a01:4f8:162:7ffe:1::2/128 :: U 1024 0 1 eth0
2a01:4f8:162:7ffe:6::/80 :: U 256 0 0 eth0
fe80::/64 :: U 256 0 0 eth0
::/0 2a01:4f8:162:7ffe:1::2 UG 1024 0 0 eth0
::/0 :: !n -1 1 6 lo
::1/128 :: Un 0 1 5 lo
2a01:4f8:162:7ffe:6::2/128 :: Un 0 1 190 lo
fe80::5054:ff:fe3d:5f4c/128 :: Un 0 1 0 lo
ff00::/8 :: U 256 0 0 eth0
::/0 :: !n -1 1 6 lo
You describe the situation as 'the IPv4 address is mapped to another server'. Does that mean the IPv4 address is actually removed from server #1 (unconfigured from network interface) or just that it doesn't get routed to the system?
I ask this because the order in resolv.conf will try IPv4 first and IPv6 second, so when the server 'thinks' it has IPv4 it will send out a packet over IPv4 and will never see the answer (and server #2 will ignore it).
The solution would be to find out what process causes the IPv4 addresses in resolvconf config and what process causes the IPv6 addresses and switch those around in /etc/resolvconf/interface-order