Detailed explanation of static DNS configuration method in Ubuntu

Introduction to DNS service:

DNS (Domain Name Server, domain name server) is a server that converts a domain name (domain name) and its corresponding IP address (IP address). A table of domain names and corresponding IP addresses (IP addresses) is stored in DNS to resolve the domain names of messages.

Because the mimic storage system implemented in the laboratory needs to dynamically change the ip address, a dns server needs to be built, and the servers that need to query and change the ip address are bound to the same dns server. Usually in RedHat series (eg: Fedora, Centos) systems, when we need to change the dns server is a very simple matter, you can directly modify the corresponding /etc/resolv.conf file. Just add or modify the ip address behind the nameserver. But I stupidly thought that this is the same setting under the Debian series (eg: Ubuntu, Mint), and it seems that it can be used even if it is changed, so I didn't study it carefully.

After a power outage and restart one day, the DNS service on the Ubuntu system collectively failed, and then the investigation found that the /etc/resolv.conf file was overwritten, and the originally configured dns information disappeared. As shown below:

囧rz! Ubuntu has told you, DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN.

**System environment: **

System platform: Ubuntu 14.04

Let's sort through the editing rules of resolv.conf under Ubuntu, and then we can sum up how to prescribe the right medicine to deal with the problem of static DNS configuration restart failure.

Process analysis:

  1. In the process of starting the network device of the Ubuntu system, the network interface will be initialized by the configuration file of /etc/network/interface, so the corresponding dns server directly configured in /etc/network/interface will be written into /etc/ first resolv.conf. So we can add the following content:
dns-nameservers 180.76.76.76//Support, Baidu's DNS server
  1. Next, NetworkManager will fill in /etc/resolv.conf by relay. Depend on the configuration file /etc/NetworkManager/NetworkManager.conf By modifying the dns items in this configuration file, we can also achieve the purpose of static dns configuration:
 dns=119.29.29.29//Tencent's DNS server
  1. If you miss the first two steps, it doesn't matter, we still have a chance to remedy it. Next, resolv will read its own dns configuration file and write it to /etc/resolv.conf. The dependent configuration file is /etc/resolvconf/resolv.conf.d/tail. By adding a dns server, we can also write to our statically configured dns server.
 nameserver=223.5.5.5//Ali's DNS server

Static IP configuration

Ubuntu's network configuration information is placed in /etc/network/interfaces. If the configuration is configured to obtain ip dynamically, add the following content to the above file:

Use the following command to open the network configuration information file:

sudo gedit /etc/network/interfaces

Edit the file (pay attention to check if your getway is correct.):

 auto eth0
 iface eth0 inet static
 address 192.168.8.119
 netmask 255.255.255.0
 gateway 192.168.8.1

After the configuration is complete, restart the network:

sudo /etc/init.d/networking restart

At this time, the modified configuration information is viewed

to sum up

The binding process of the Linux static DNS server under the Debian series of distributions has been sorted out in detail. We can use any of the above three methods. (囧rz, each method has a different syntax, cheating Linux) Of course, the RedHat series of distributions can refer to the above content, the static configuration of the dns server process should be similar.

Well, the above is the entire content of this article. I hope that the content of this article has a certain reference learning value for everyone's study or work. If you have any questions, you can leave a message and communicate. Thank you for your support to ZaLou.Cn.

Recommended Posts

Detailed explanation of static DNS configuration method in Ubuntu
Detailed explanation of static DNS configuration under Ubuntu system
Detailed explanation of ubuntu using gpg2
Detailed explanation of quick installation and configuration of Subversion (SVN) under Ubuntu
Detailed explanation of the installation and use of SSH in the Ubuntu environment
Detailed explanation of the principle of Python super() method
Installation, configuration and uninstallation of GitLab in Ubuntu19.1
Detailed explanation of CentOS7 network setting tutorial in vmware
Use of Anaconda in Ubuntu
ubuntu 18.04 set static ip method
Detailed explanation of Spark installation and configuration tutorial under centOS7
Summary of logarithm method in Python
Detailed explanation of python backtracking template
Happy installation of Jenkins in ubuntu
Detailed explanation of python sequence types
Detailed use of nmcli in CentOS8
Detailed usage of dictionary in Python
Detailed examples of Centos6 network configuration
Centos 7 RAID 5 detailed explanation and configuration
Detailed explanation of the use of pip in Python | summary of third-party library installation
Detailed explanation of Python IO port multiplexing
JDK environment variable configuration method under ubuntu
Installation and deployment of Nginx in Ubuntu
Ubuntu17.04 configuration method to replace domestic sources
Method of installing django module in python
How to set static IP in ubuntu14.04
Ubuntu install PHP and PHP Nginx configuration method
Swap (virtual memory) setting method in ubuntu
Detailed explanation of -u parameter of python command
CentOS8 yum/dnf configuration method of domestic sources
Detailed explanation of Python guessing algorithm problems
Ubuntu20.04 install Python3 virtual environment tutorial detailed explanation
Detailed Ubuntu 16.04 pycharm setting desktop shortcut startup method
Summary of CentOS method to set static IP
Detailed explanation of python standard library OS module
The basic configuration and interface beautification of Ubuntu
Detailed explanation of the usage of Python decimal module
Detailed explanation of how python supports concurrent methods
The consequences of uninstalling python in ubuntu, very
Detailed explanation of data types based on Python
Installation and configuration of CentOS 7 in VMware Workstation
Introduction to the use of Hanlp in ubuntu
Detailed explanation of building Hadoop environment on CentOS 6.5
The latest method of installing Mongodb on Ubuntu 16.04
Explain the implementation of Centos8 static IP configuration
Installation and use of SSH in Ubuntu environment