i want to prevent the local DNS server on my OpenWRT router to announce IPv6 records when querying the hostname by which the router is reachable from the Internet.
Q: Why do i want this?
A: I have an instance of Wireguard running on my OpenWRT Router. I want clients in my LAN to connect to this Wireguard server over the internet (not directly via LAN). When clients in my local network resolve the FQDN my.host.com, Wireguard uses the IPv6 address ::1. As the Wireguard Server is not listening on ::1 the client will never be able to connect.
Do you have a working solution on how to configure dnsmasq or odhcpd in a way that only resolve IPv4 A-Records and not IPv6 AAAA records for my use case?
#Method#1
your first solution seems to quite do the trick, except that it is delivering a static record back. With a regularly changing IP-Address i believe this is not the right solution.
However, this is actually the result i would like to see, just without hardcoding the IP-address.
#Method#2
When using this solution, i cannot observe any changes (yes, i restarted dnsmasq)
See the output here:
i tried it in all possible combinations, but it just will not work. It is crazy. even an nslookup my.host.com 8.8.8.8 delivers me ::1 together with my correct ipv4 address.
I dont know where to go further. My router is possessed by a daemon!
Hm, it seems like i have been too fast with marking this answer as a solution.
It is important to mention, that when setting these attributes it definitely has to be done via uci with the add_list command and not with the add or set command.
E.g.: