I have some code inherited, which checks on a Linux router for IPv4 network connectivity. There is one check for IPv6 addresses, if they are in the 0:0:0:0:0:ffff:: network. Is it a valid scenario, that an interface can have an IPv6 address in this IPv6 range, and no IPv4 address, and can communicate in an IPv4 network?
2 Answers
No, that won't work. The mapped addresses are used to represent IPv4 network connections in IPv6 software. But that's all they are: a representation in software. Assigning them to a network interface or sending actual packets on the network won't work. If somebody does that then it's not valid IPv6.

- 7,712
- 19
- 29
There are interesting less obvious use cases as well. If the check is for IPv4 connectivity, that requires zero IPv4 addresses due to various transition mechanisms like NAT64. Possibly the only IPv4 address is on a different gateway and there is address translation to encode it in IPv6. In which case a good check is to make a request to a known resource with only an A record in DNS.
Of course if the real question is just if an interface is on a v4 subnet that's easier to find out, ip -4 addr
for example.

- 32,050
- 2
- 19
- 34