[内容] /etc/resolv.conf 配置文件的 search 选项

内容一:测试 search 选项的配置

# cat /etc/resolv.conf
search eternalcenter.com local new
nameserver 8.8.8.8

内容二:测试 search 选项

2.1 查询 zhumingyu

# host -a zhumingyu
Trying "zhumingyu.eternalcenter.com"
Trying "zhumingyu.local"
Trying "zhumingyu.new"
Trying "zhumingyu"
Host zhumingyu not found: 3(NXDOMAIN)
Received 102 bytes from 8.8.8.8#53 in 62 ms

(补充:当查询 zhumingyu 时,也就是中间没有点 “.”,则默认会被视为查询主机名,会先依次把 eternalcenter.com、local 和 new 作为后缀添加到 zhumingyu 后进行查询,最后才查询 zhumingyu)

2.2 zhumingyu.com

# host -a zhumingyu.com
Trying "zhumingyu.com"
Received 31 bytes from 1.1.1.1#53 in 217 ms
Trying "zhumingyu.com.eternalcenter.com"
Trying "zhumingyu.com.local"
Trying "zhumingyu.com.new"
Host zhumingyu.com.new not found: 4(NOTIMP)
Received 35 bytes from 1.1.1.1#53 in 218 ms

(补充:当查询 zhumingyu.com 时,也就是中间有 1 个点 “.”,则默认会被视为查询域名,会先查询 mingyuzhu.com,如果查询失败,则会先依次把 eternalcenter.com、local 和 new 作为后缀添加到 zhumingyu 后进行查询)

2.3 查询 zhumingyu.com.

# host -a zhumingyu.com.
Trying "zhumingyu.com"
Host zhumingyu.com not found: 4(NOTIMP)
Received 31 bytes from 1.1.1.1#53 in 204 ms
Received 31 bytes from 1.1.1.1#53 in 204 ms

(补充:当查询 zhumingyu.com. 时,也就是末尾有 1 个点 “.”,默认会被视为查询域名,且只会查询这个域名。不会查询 search 里的每 1 项)