How to edit the systemd-resolved service file on Fedora?

NextDNS for instance recommends systemd-resolved, but only gives the following instructions:

Use the following in /etc/systemd/resolved.conf:

[Resolve]
<personal addresses>
DNSOverTLS=yes

I was able to change the system-wide settings by modifying the file and applying the settings:

# systemctl daemon-reload
# restart systemd-networkd
# systemctl daemon-reload

The DNS server has been successfully changed, but I wanted to confirm if this is a safe approach.

UPDATE: # systemctl edit systemd-resolved.service may approach the solution.

2 Likes
sudo mkdir -p /etc/systemd/resolved.conf.d
sudo tee /etc/systemd/resolved.conf.d/00-custom.conf << EOF > /dev/null
[Resolve]
DNS=1.2.3.4#example.org 5.6.7.8#example.org
DNSOverTLS=yes
EOF
sudo systemctl restart systemd-resolved.service

resolved.conf

2 Likes

Sorry for the late reply.

Running systemd-resolve --status prints the new values (under Global).