File resolv.conf
is usually overwritten during server restart. In my case all Vmin docs and suggestions from Eric didnt work, it could be because of virtualization, so i made a simple solution.
First create new file with the same name resolv.conf
in root folder (or new folder, doesnt matter). Edit new file and add:
search domain1.tld domain2.tld domain3.tld (and so on, depends how many domains you have)
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver xxx.xxx.xxx.xxx (your server IP)
Then edit etc/rc.local
and add this line:
/bin/cp /root/resolv.conf /etc/resolv.conf
Of course if you saved your custom resolv.conf
somewhere else and not in root then change /root/resolv.conf
to match your path.
This solution works on Centos 7 without any problem but i’m not sure if can be applied to Ubuntu.
P.S. Before you restart your server make a local copy of your original resolv.conf
file.