If for some reason in your OpenVZ or KVM VPS and if it based on Ubuntu if DNS Resolvers are not working, then just do following steps to fix:
mkdir /etc/systemd/resolved.conf.d/
vi /etc/systemd/resolved.conf.d/dns_servers.conf
Put this in the dns_servers.conf
[Resolve]
DNS=8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844
Then run following command
systemctl restart systemd-resolved