NB! This guide is not applicable for Ubuntu 18.04 with Desktop environment, please use another one as you will need to change Network Manager configuration too.
In our case we decided to disable it because of non RFC compliant resolver in customer's network:
Jan 18 18:19:05 fastnetmon systemd-resolved[953]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying
First of all, confirm current DNS server:
sudo systemd-resolve --status|grep 'DNS Servers'
Currently default configuration is following:
ls -la /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Mar 2 17:23 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
You will need to stop and disable resolved:
sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved.service
Then remove symlink:
sudo rm /etc/resolv.conf
And add customer's configuration (replace x.x.x.x by IP address of DNS server in your network):
echo 'search companyname.com' | sudo tee -a /etc/resolv.conf
echo 'nameserver x.x.x.x' | sudo tee -a /etc/resolv.conf
echo 'nameserver 8.8.8.8' | sudo tee -a /etc/resolv.conf
echo 'nameserver 1.1.1.1' | sudo tee -a /etc/resolv.conf
After that, I can recommend rebooting and checking that DNS resolution works fine on this server.