Updated 2019-02-27
Server: Ubuntu 18.04
Provider: Vultr
First of all, there are many tricks.. to set custom DNS on the latest Ubuntu
Let’s get our hand dirty
1. Edit resolved config file
nano /etc/systemd/resolved.conf
2. Replace #DNS into DNS
DNS=9.9.9.9 1.1.1.1
3. Restart systemd service
service systemd-resolved restart
4. Finally, check the status
systemd-resolve --status
// Method 2
nano /etc/resolvconf/resolv.conf.d/head
// Put nameserver inside
nameserver 9.9.9.9
nameserver 1.1.1.1
OR
nano /etc/resolv.conf
nameserver 9.9.9.9
nameserver 1.1.1.1