I am running two synced instances of AdGuard Home within my local network, and I wish to use them as my Ubuntu (24.04.2) desktop's DNS servers. These DNS servers currently only have IPv4 addresses; I have not assigned them IPv6 addresses yet and am not currently using IPv6 on my network.
In Settings - WiFi - [the current WiFi network] - IPv4, I have entered their IPv4 addresses under DNS, and have unchecked the "Automatic" toggle.
I have also, in accordance with the advice given in this question, edited /etc/gai.conf and uncommented/edited these lines:
# precedence <mask> <value>
# Add another rule to the RFC 3484 precedence table. See section 2.1
# and 10.3 in RFC 3484. The default is:
#
precedence ::1/128 50
precedence ::/0 40
precedence 2002::/16 30
precedence ::/96 20
precedence ::ffff:0:0/96 100 # I manually changed this from 10
#
# For sites which prefer IPv4 connections change the last line to
#
#precedence ::ffff:0:0/96 100 # I did not uncomment this, instead choosing to edit the last line above
If I save this, then execute sudo systemctl restart systemd-resolved, then for a while, resolvectl status shows that the current DNS server is one of my AdGuard Home instances:
Link 3 (wlp29s0)
Current Scopes: DNS
Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: <IPv4 address of the AdGuard Home instance>
But that doesn't hold; after some time, it reverts again to IPv6:
Link 3 (wlp29s0)
Current Scopes: DNS
Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: <IPv6 address>
I don't want to disable IPv6 altogether. In the long run, I'm sure it would be prudent to use IPv6 in my home network. However, presently, I want my desktop to reliably, consistently prioritize the DNS servers defined in IPv4 settings instead of IPv6 DNS servers, so I can use local domain rewrites and other benefits of AdGuard Home.
What do I need to ensure this?