I want to set the system to send DNS queries with a custom port, not 53
. I added DNS=127.0.0.1 9053
to /etc/systemd/resolved.conf
and DNS=127.0.0.1:9053
to /etc/systemd/networkd.conf
. But now DNS queries are sent via the default DNS with port 53
. What can I do?
Yeah, that’s normal, intended, and does not prevent general lookups taking the global DNS first. Do you see an issue with this?
I gave this setup a try real quick, to make sure I’m not overlooking something, with dnsmasq for testing on 127.0.0.1:9053:
When triggering a query on that test record, f. ex. with
ping -c1 testme.localnet
, you’ll see it’s directed to the dnsmasq instance and working as intended:The DNS setup with systemd-resolved is pretty confusing, and outright contradicts many, MANY previously correct instructions of how to set your
/etc/resolv.conf
. I’m not surprised if it is giving you a headache right now, but all I can say is to diligently work through its configuration, and understand how systemd-resolved is supposed to work. From experience, make sure your tests are sound and representative, or you’ll continue looking for errors in your setup despite everything actually working just fine, maybe because you missed a reload or had a typo or misunderstanding in your wireshark filter.In the same vein, make sure your DNS listening on :9053 is really working as intended, otherwise you can bark up the wrong tree all day long. Debug logging is your friend, and more accessible and less error prone than tcpdump/wireshark.
You’ll figure it out from here, I’m sure.
Thanks! I wasted your time. As you said the problem caused a headache to me. I stop trying on it for some days.
Wise decision! Best of luck for when you give it another try, with fresh eyes and a clear mind, and enjoy your XP gain dopamine on the way.