The role of the search item in the/etc/resolv.conf file

Source: Internet
Author: User
Tags bind domain server fully qualified domain name

Host name resolution rule order when there are search entries in the resolv.conf file:
The DNS configuration file is as follows:

# vi/etc/resolv.conf
# Generated by NetworkManager
search openstack.local dev.com example.local
NameServer 192.168.122.21

Example 1: Query the hostname, because there is no point after the host name, it is considered the hostname, so first add search in order to make each of the FQDN (fully qualified domain name) to query, fully qualified domain name query is not found, and then think the hostname is fully qualified domain name to query.

# host-a centos7-bind-1
Trying "centos7-bind-1.openstack.local"
Trying "centos7-bind-1.dev.com"
Trying "Centos7-bind-1.example.local"
Trying "centos7-bind-1";
connection timed out; No servers could is reached

Example 2: Query the hostname, because the host name in a bit (not at the end of a bit), it is considered to be a fully qualified domain name, first use it to query, query failure to take it as a hostname to do, add each of the search in the FQDN (fully qualified domain name) to query.

# host-a centos7-bind-1.com
Trying "centos7-bind-1.com"
Received 109 bytes from 192.168.122.21#53 in 177 Ms
Trying "centos7-bind-1.com.openstack.local"
Trying "centos7-bind-1.com.dev.com"
Trying " Centos7-bind-1.com.example.local "
Host centos7-bind-1.com not Found:3 (NXDOMAIN) Received the bytes from
192.168.122.21#53 in MS

Example 3: Query the hostname, because the host name in the end of a bit, it is considered to be a fully qualified domain name, only use it to query (no longer add each item in search). The number of queries will be related to the number of domain names in search.

# host-a centos7-bind-1.
Trying "Centos7-bind-1"
; connection timed out; Trying next Origin
Trying "centos7-bind-1"
;; connection Timed out; Trying next origin
trying "centos7-bind-1";
connection timed out; Trying next origin
trying " Centos7-bind-1 "
;; connection timed out; No servers could being reached

DNS Query tool: Introduction to host Command
Usage: host [-A] FQDN [server]
HOST-L domain [Server]
-A parameter: Displays all the details of the query.
-L parameter: Lists all host data managed by the domain if the following domain allows Allow-transfer.
Server parameters: This parameter is optional, when you want to use a non-/etc/resolv.conf DNS host, to query the host name and IP corresponding, you can use this parameter.

Host command Use example (lists all host data managed by the domain):

# host-l example.local  192.168.122.84
Using domain server:
name:192.168.122.84
Address: 192.168.122.84#53
Aliases: 

example.local name server ns.example.local.
Dns.example.local has address 192.168.123.10
ns.example.local have address 192.168.122.84
Ns.example.local has IPV6 Address:: 1
sss.example.local has address 192.168.123.9
www.example.local have address 192.168.123.8

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.