DNS 搜索域
示例:
cat /etc/resolv.conf
options timeout:2 attempts:5
; generated by /usr/sbin/dhclient-script
search ap-east-1.compute.internal
nameserver 10.23.0.2
resolv.conf 第三行 以 search 开头。
man 信息,提示
man resolv.conf
search Search list for host-name lookup.
The search list is normally determined from the local domain name; by default, it contains only
the local domain name. This may be changed by listing the desired domain search path following
the search keyword with spaces or tabs separating the names. Resolver queries having fewer than
ndots dots (default is 1) in them will be attempted using each component of the search path in
turn until a match is found. For environments with multiple subdomains please read options
ndots:n below to avoid man-in-the-middle attacks and unnecessary traffic for the root-dns-servers.
Note that this process may be slow and will generate a lot of network traffic if the servers for
the listed domains are not local, and that queries will time out if no server is available for one
of the domains.
The search list is currently limited to six domains with a total of 256 characters.
搜索域
搜索域用作域搜索列表的一部分域。解析程序使用域搜索列表以及本地域名。
当dns查询不到你所输入的域名时,会将dns搜索域拼接在你所查询的域名后面再次进行查询。
例子
假设内网中有一台服务器名为adgk.local当我们需要访问它时需要在浏览器输入http://adgk.local,如果把dns搜索域设置成local那么你可以通过http://adgk来访问这台服务器也可以通过http://adgk.local来访问这台服务器。
本文来自博客园, 作者:Star-Hitian, 转载请注明原文链接:https://www.cnblogs.com/Star-Haitian/p/16498708.html