I believe its saved in the network config when using the Hostname and DNS settings page.
Look at /etc/network/interfaces file. ‘dns-nameservers’ will be listed in the interface settings.
If you are using a VPS or a server configured with DHCP, it is common for the “resolv.conf” file to be overwritten by the DHCP server. This can drive you nuts without question as it did so many times before I learned how to address the matter.
You can effectively write content to the “resolv.conf” file, then make the file “read-only” making any further changes impossible until you remove the read-only status on the file.
The trick to making a file “read-only” or “immutable” comes with the program “chattr” which can change this attribute.
Once you’ve made the change, and before you restart the network (or Apply in Webmin) you need to go to the command line and enter:
chattr +i /etc/resolv.conf
If at a later date you want make changes to the file, simply enter the following command:
chattr -i /etc/resolv.conf
This will remove the write protection from the file.
Go to /root and run cp /etc/resolv.conf /root/resolv.conf.
Use WinSCP, nano or any other software and open /etc/rc.local.
At the bottom insert this line /bin/cp /root/resolv.conf /etc/resolv.conf.
Leave one empty line at the end and save.
Again use WinSCP (nano…) and open /root/resolv.conf.
This is what you should have in this file:
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver xxx.xxx.xxx.xxx
where xxx.xxx.xxx.xxx is IP of your server.
Dont mess up this order, e.g. must be exactly as i posted.
Save /root/resolv.conf.
Last but not least check if /etc/rc.local is executable, if isnt make it.
For now on every time when you restart your server the file /etc/resolv.conf will be replaced with /root/resolv.conf and no more problems with missing 127.0.0.1. This is why i call this “dirty” trick but compared to anything else it will work 100%… at least i never encountered any problem. This usually happens with VPS on OpenVZ virtualization.
P.S. This was for Centos 6/7 but it should work with any other OS.