Detailed explanation of the /etc/resolv.conf file of the Linux root file system

Hello everyone, today 51 Open Source will introduce you a configuration file, that is /etc/resolv.conf. Many netizens do not know much about the usefulness of this file. In fact, it is not complicated. It is the DNS client configuration file, which is used to set the IP address and DNS domain name of the DNS server, and also contains the domain name search order of the host. This file is a configuration file used by resolvers (a library that resolves IP addresses from hostnames). Its format is simple, with each line starting with a keyword followed by one or more arguments separated by spaces.
There are four main keywords in resolv.conf, which are:
nameserver //Define the IP address of the DNS server
domain //Define the local domain name
search //Define the search list of domain names
sortlist //sort the returned domain names
Below we give an example of /etc/resolv.conf:
domain  51osos.com
search   www.51osos.com   51osos.com
nameserver 202.102.192.68
nameserver 202.102.192.69
The most important is the nameserver keyword. If the nameserver is not specified, the DNS server cannot be found. Other keywords are optional.
nameserver indicates that the host specified by this address is the domain name server when resolving domain names. The domain name servers are queried in the order in which they appear in the file, and the following nameservers are queried only when the first nameserver does not respond.
domain     declares the domain name of the host. It is used by many programs, such as mail systems; it is also used when doing DNS queries for hosts that do not have a domain name. If there is no domain name, the hostname will be used, removing everything before the first dot ( .).
search     Its multiple parameters specify the domain name query order. When querying a host without a domain name, the host will be looked up separately in the domain declared by search.
domain and search cannot coexist; if both exist, the latter will be used.
sortlist    allows a specific ordering of the resulting domain names. Its arguments are net/mask pairs, allowing arbitrary permutation order.
 
http://blog.csdn.net/mybelief321/article/details/10049429

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326344683&siteId=291194637