DNS problems on BigSur

Several hours after the start of a mac with macOS BigSur, I am unable to access www apple com. Thid creates a lot of problems.

I spent a lot of time exploring what the cause could be.

DNS state when the problem does not manifest itself

Whenever I restart the mac, the problem disappears. Looking as dscacheutil, I can see both IPv4 and IPv6 are being populated.

$dscacheutil -q host -a name www.apple.com
name: e6858.dscx.akamaiedge.net
alias: www.apple.com www.apple.com.edgekey.net www.apple.com.edgekey.net.globalredir.akadns.net 
ipv6_address: 2a02:26f0:7400:1ac::1aca
ipv6_address: 2a02:26f0:7400:1ad::1aca

name: e6858.dscx.akamaiedge.net
alias: www.apple.com www.apple.com.edgekey.net www.apple.com.edgekey.net.globalredir.akadns.net 
ip_address: 2.21.169.157

DNS state when the problem does manifest itself

After a few hours and a sleep of the mac, I cannot access www apple com in any way.

$dscacheutil -q host -a name www.apple.com
name: e6858.dscx.akamaiedge.net
alias: www.apple.com www.apple.com.edgekey.net www.apple.com.edgekey.net.globalredir.akadns.net 
ipv6_address: 2a02:26f0:7400:1ac::1aca
ipv6_address: 2a02:26f0:7400:1ad::1aca

So IPv4 addresses are not populated at that point.

I noticed that apple com itself (without the www) can be pinged. And indeed the dns resolution has IPv4 populated :

$ dscacheutil -q host -a name apple.com
name: apple.com
ip_address: 17.253.144.10

  • This is on a network that supports only IPv4, not IPv6.
  • Running “sudo dscacheutil -flushcache ; sudo killall -HUP mDNSResponder” or rebooting the router does not fix the issue. - Only rebooting the mac fixes the issue.
  • dig correctly returns both IPv4 and IPv6 addresses.

Can anyone help me in any way understand the problem?