The DNS information in Ubuntu 14.04.4 LTS is provided by /etc/resolv.conf , which is generated by /sbin/resolvconf each time it is powered on
/etc/resolv.conf is a symbolic link to /run/resolvconf/resolv.conf
#ls-al/etc/resolv.conf#lrwxrwxrwx 1 root root 4-18:57/etc/resolv.conf. /run/resolvconf/resolv.conf
The method of adding DNS in file/etc/resolv.conf is not feasible , because after rebooting the system, the configuration file will be overwritten again, see the following instructions:
#cat/etc/resolv.conf # Dynamic resolv.conf (5) file for glibc resolver (3) generated by resolvconf (8) # does not EDIT T His FILE by HAND--YOUR changes'll be overwritten
There is a resolvconf service in Ubuntu that is used to control the content of /etc/resolv.conf .
So once we restart the system or the service, the contents of the /etc/resolv.conf file will be restored to the original content.
So modifying /etc/resolv.conf directly does not solve this problem.
You can modify the following methods:
Method One:
Modify the following file, default is empty
Vim/etc/resolvconf/resolv.conf.d/base
Include the DNS server address you want to add, for example:
NameServer 223.5.5.5nameserver 114.114.114.114
Save, and then execute
#/sbin/resolvconf-u
Or
#etc/init.d/resolvconf Restart
or reboot the system.
See the /etc/resolv.conf file again, and add the content we added to the
#cat/etc/resolv.conf
Method Two:
#vim/etc/network/interfaces dns-nameservers 8.8.8.8 114.114.114.114
(Method Two has not been tested)
Common DNS:
China Internet Center (recommended, safe and fast):
1.2.4.8,210.2.4.8,101.226.4.6(Telecom and Mobile),123.125.81.6(China Unicom)
Ali DNS:
223.5.5.5,223.6.6.6
Googledns(not recommended, easy to swap, also very slow):
8.8.8.8,8.8.4.4
OpenDNS:
208.67.222.222
208.67.220.220
208.67.222.220
208.67.220.222
There are also two Family Shield Serversthat can block a malicious website
208.67.222.123
208.67.220.123 IPv6 Address
2620:0:ccc::2
2620:0:ccd::2
DNS(Recommended):
Pure no hijacking no longer need to endure being twisted to see ads or vulgar website pain Service address:
114.114.114.114 and 114.114.115.115
Interception of Phishing virus Trojan website Enhanced Network silver, securities, shopping, games, privacy information security services address:
114.114.114.119 and 114.114.115.119
This article is from the "Under Siege" blog, make sure to keep this source http://308107405.blog.51cto.com/6396647/1942381
Ubuntu 14.04.4 lts set up DNS