dns-search选项在/ etc / network / interfaces中是什么意思?


38

任何人都可以向我解释文件中的dns-search指令/etc/network/interfaces

iface eth0 inet static
    address 192.168.3.3
    netmask 255.255.255.0
    gateway 192.168.3.1
    dns-search example.com
    dns-nameservers 192.168.3.45 192.168.8.10

它是强制性的吗?我该如何配置呢?


1
我个人在服务器上禁用了此功能,因为我使用的是IPv6,并且当我尝试连接的地址(fe hello.com)不支持IPv6时,系统尝试改为解析,hello.com.example.com并产生了IPv6 example.com作为结果(不是hello.com预期的IPv4地址)。我在这里详细介绍了它:daysleeper.cz/…–
安排

Answers:


32

dns-search 确定为DNS查找附加哪个域。

通常,您将在此处指定与返回的域名相同的域名hostname -f

有关详细信息,请参见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.

2
为什么在手册页中没有为接口文件提到dns-search指令?(manpages.ubuntu.com/manpages/utopic/en/man5/interfaces.5.html
odigity

4
@odigity,我认为这是因为它是传递给resolvconf的选项,而不是ifup的内部功能。
Tiago

所有这些如何与/etc/nsswitch.conf中定义的搜索顺序一起悬挂?听起来像是对同一问题的多种治疗方法
David Walker
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.