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

pyl*_*ver 41 networking dns

任何人都可以向我解释文件中的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
Run Code Online (Sandbox Code Playgroud)

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

H.-*_*itt 34

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.
Run Code Online (Sandbox Code Playgroud)

  • @odigity,我认为这是因为它是传递给 resolvconf 的选项,而不是 ifup 的内部功能。 (4认同)
  • 为什么接口文件的手册页中没有提到 dns-search 指令?(http://manpages.ubuntu.com/manpages/utopic/en/man5/interfaces.5.html) (2认同)