systemd-resolved
is not really known for it's full-featured configuration options! But I think with a bit of iptables
magic, you can get it to work with.
First do something like this:
[Resolve]
DNS=127.0.0.52 #instead of 127.0.0.53 which is systemd-resolved itself.
You can of course choose any other number between 2-255. Just don't use 53 itself.
Then you have to redirect any packets headed for 127.0.0.1:53
to 127.0.0.52:53
with iptables
. Here is my best untested attempt: (I don't have your environment to test this, correct me if I'm wrong)
iptables -t nat -I OUTPUT -d 127.0.0.1 --dport 53 -j REDIRECT --to-destination 127.0.0.52 --to-ports 53
and finally you should probably make this config persistent on reboots. iptables-persistent
might help.
Some Helpful links: