Use at your peril, this kinda works but you will need to find a way to have systemd load this with the network, otherwise you'll have to manually start resolved and any other services that depend on name resolution. It's a gimicky trick at best.
I needed to run a simple dns server and didn't want to mess with bind, I was using dnsmasq but it broke when I upgraded ubuntu 24.04, it is a known bug (#2055012) but it doesn't look like they're going to address it anytime soon. I was able to find a work around with systemd-resolved. I want to be able to resolve for my own fake domain within my network (e.g. whatever.blah) - this was driven by some services and apps I was running behind haproxy which needs proper fqdn to work for me:
- /etc/hosts # normal etc hosts syntax
- /etc/haproxy/haproxy.conf # normal haproxy config using face domain name
- /etc/systemd/resolved.conf Make sure that these are no