By modifying:
sudo vi /etc/resolvconf/resolv.conf.d/base (this file is empty by default)
Insert inside:
nameserver 8.8.8.8
nameserver 8.8.4.4
If there are multiple DNS, one per line
Modify and save, then execute
sudo resolvconf -u
Looking at /etc/resolv.conf again, there are two more lines at the bottom:
cat /etc/resolv.conf
# 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
nameserver 8.8.8.8
nameserver 8.8.4.4
You can see that our settings have been added, and then ping a domain name, it can be resolved at that time without restarting.
Reference: http://blog.csdn.net/yangcs2009/article/details/26674311