search 它的多个参数指明域名查询顺序。当要查询没有域名的主机,主机将在由search 声明的域中分别查找。domain 和search 不能共存;如果同时存在,后面出现的将会被使用。
在/etc/resolv.conf 配置文件:domain 和search作用是一样的
domain linpro.no
search linpro.no uio.no ifi.uio.no
domain function:
Had I typed telnet math.uio.no. with the trailing dot, the resolver would have known it was an FQDN and would have looked up math.uio.no at once, without trying to append the specified domain first. Not all applications are tolerant of the trailing dot, though, so it can't always be specified.
search function:
When ssh gram is executed, the resolver first looks for gram.linpro.no, which does not exist; thengram.uio.no, which does not exist, either; and finally gram.ifi.uio.no, which will succeed because it does exist
本文解释了在/etc/resolv.conf配置文件中domain与search的作用及区别。domain用于声明主机的域名,而search则定义了域名查询的顺序。两者不可共存,且在实际应用中有其特定的使用场景。
232

被折叠的 条评论
为什么被折叠?



