Although we may install CentOS, Ubuntu and other image systems according to our own habits when choosing domestic or foreign host vendors, there are still some differences in the process of re installing software due to the vendor's configuration problems. For example, Lao Zuo made an error in installing the ubuntu system to update the source on a domestic merchant server today.
At first, we thought it was a problem with the source, so we also had problems when replacing AliCloud and 163 sources. Finally, we found that DNS was not configured, so we changed it to Google DNS (8 8 8 8/8 8 4 4) according to custom, but the configuration file was lost after restarting the server. This is not good. If the server is restarted, it may affect the system files. How to solve it specifically?
Here we see this when setting the resolv.conf file in the server.
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
DNS has not survived, so we need to solve the problem of restarting the server to keep DNS valid.
First, add a configuration file
/etc/network/interfaces
Add at the end of this file
dns-nameservers 8.8.8.8
dns-nameservers 8.8.4.4
Save the replacement after adding.
II. Effectiveness of the Implementation Document
resolvconf -u
It takes effect after the file is executed. Of course, it is better to restart the server and check whether the resolv.conf file has two more lines.
In this way, we can see that DNS will not disappear because the server is restarted.
Scan the code to follow the official account
Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge