/Etc/resolv. after dns is set in conf, the file will be overwritten every time tuserver is restarted. To solve this problem, find some solutions to prevent/etc/resolv. method 1 covered by conf. you need to create a file/etc/resolvconf/resolv. conf. d/tailsudovi/etc/resolvconf/resolv. conf. d/tail2. write yourself to the file
After dns is set in/etc/resolv. conf, the file will be overwritten every time the Ubuntu Server is restarted. In this case, some solutions are provided.
Methods to prevent/etc/resolv. conf from being overwritten
Method 1
1. Create a file/etc/resolvconf/resolv. conf. d/tail.
Sudo vi/etc/resolvconf/resolv. conf. d/tail
2. Write the desired dns server to the file in the same format as/etc/resolv. conf.
Nameserver8.8.8.8
3. Restart the resolvconf program.
Sudo/etc/init. d/resolvconf restart
Check the/etc/resolv. conf file and you can see that the dns server you added has been added to this file.
Method 2
In/etc/network/interfaces
- ### Interfaces #######
- Auto eth0
- Iface eth0 inetStatic
- Address192.168.3.250
- Netmask255.255.255.0# Subnet Mask
- Gateway192.168.3.1# Gateway
- Dns-nameservers8.8.8.8 8.8.4.4# Setting dns servers