I want to add local DNS server with port 8600 to systemd-resolved for request forwarding. I've tried to change /etc/systemd/resolved.conf like this


but this is not counts as a port (btw, : didn't works too)

Is there a way to do this?

2 Answers 2


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:

DNS= #instead of 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 to 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 --dport 53 -j REDIRECT --to-destination --to-ports 53

and finally you should probably make this config persistent on reboots. iptables-persistent might help.

Some Helpful links:

  • 1
    I got this to work by changing the iptables rules a bit: iptables -t nat -A OUTPUT -d -p udp -m udp --dport 53 -j REDIRECT --to-ports 8600 and iptables -t nat -A OUTPUT -d -p tcp -m tcp --dport 53 -j REDIRECT --to-ports 8600 May 21, 2021 at 11:54

you may simply specify the port(works with DoT at least):


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.