The following is the basic solution for setting up DNS servers in Ubuntu. Because network-manager always causes various problems, you can uninstall it in anger and manually modify/etc/network/interfaces as follows: # Thisfiledescribesthenetworkinterfacesavailableonyoursystem # andhowtoactivatethem.
The following is the basic solution for setting up DNS servers in Ubuntu.
Because network-manager always causes various problems, you can uninstall it in anger and manually modify/etc/network/interfaces as follows:
# This file describes the network interfaces available on your system
# And how to activate them. For more information, see interfaces (5 ).
# The loopback network interface
Auto lo
Iface lo inet loopback
# The primary network interface
Auto eth0
Iface eth0 inet static
Address 192.168.2.10
Netmask 255.255.255.0
Gateway 192.168.2.1
Because I use Route dialing, it is easier to set a static address. The problem is that the DNS server address cannot be saved, and the modification to/etc/resolv. conf is useless. After the restart, it will become unavailable. What google can find is also a method that has been reproduced before. The root cause of this method is to modify/etc/dhcp3/dhclient. conf to add the DNS server. Now I have configured eth0 as a static address, so I cannot use it. This problem is found because usepeerdns in/etc/ppp/peers/dsl-provide needs to be commented out in this method, but I don't have this file at all! After testing and restarting n times, I finally found a solution. The key is that the dns information is provided by/etc/resolv. conf, and the file is still blank after I set its permission to 444. This means that this file is generated during the boot process. After a mess is found, it is generated by/sbin/resolvconf-u. The three file names are completely clear, so it is easy to add the dns to the base (the other two are actually the same. For example, to use an OpenDNS server, you only need to perform the following operations:
Su
Echo "nameserver 208.67.220.220">/etc/resolvconf/resolv. conf. d/base
Echo "nameserver 208.67.222.222">/etc/resolvconf/resolv. conf. d/base
In fact, as long as you know that the DNS server is set in/etc/resolv. conf, there is a very simple solution: add a sentence in/etc/rc. local:
Echo "nameserver 208.67.220.220">/etc/resolv. conf
This is equivalent to automatically configuring the DNS server once every boot-but this solves the problem.