Ubuntu Configure systemd-resolved

Latest Ubuntu/Debian use systemd-resolved for DNS resolution. On a fresh Ubuntu 19.04 install DNS failed to resolve.

root@ubuntu19:/# ping serverok.in
ping: serverok.in: Temporary failure in name resolution
root@ubuntu19:/# 

To fix this, create file

mkdir /etc/systemd/resolved.conf.d/
vi /etc/systemd/resolved.conf.d/dns_servers.conf

Add content

[Resolve]
DNS=8.8.8.8 1.1.1.1

Restart systemd-resolved

systemctl restart systemd-resolved

You can find systemd-resolvd status with command

resolvectl status
systemd-resolve --status

To resolve a domain, use

resolvectl query serverok.in

Comments

3 responses to “Ubuntu Configure systemd-resolved”

  1. Roman Avatar
    Roman

    Thanks! Good solution!

  2. eric Avatar
    eric

    Thanks, it’s very helpful.

  3. Abhijeet Pratap Avatar
    Abhijeet Pratap

    Thankyou! works great!

Leave a Reply

Your email address will not be published. Required fields are marked *