to prevent /etc/resolv.conf from being overwritten
[Method 1]
1. Required Create a file /etc/resolvconf/resolv.conf.d/tail
sudo vi /etc/resolvconf/resolv.conf.d/tail
2. Write the dns server you need in this file, the format is the same as /etc/resolv.conf
nameserver 8.8.8.8
3. Restart the resolvconf program
sudo /etc/init.d/resolvconf restart
Go to the /etc/resolv.conf file again, you can see that the dns server you added has been added to the file
[method 2]
in /etc/network/interfaces
###interfaces中####### auto eth0 iface eth0 inet static address 192.168.3.250 netmask 255.255.255.0 #subnet mask gateway 192.168.3.1 #gateway dns-nameservers 8.8.8.8 8.8.4.4 #Set up dns server
Reference: [url] http://www.linuxidc.com/Linux/2012-06/63054.htm [/ url]