/etc/resolv.confを理解してみてください。

/etc/resolv.confを理解してみてください。

/etc/resolv.confLinuxシステムのファイルエントリを理解しようとしています。

このファイルにはキーワードと値のリストが含まれています。

以下はコンテンツの例です/etc/resolv.conf

domain xxx.net
search xxx.net
nameserver 192.168.1.254

私が知る限り、このnameserverエントリはオペレーティングシステムがDNSクエリを解決するために使用するネイティブネームサーバーです。

私の質問は、コアタスクdomainsearch関連する値は何ですか?

ベストアンサー1

次のページで必要な情報を入手できますman

man resolv.conf
...
   domain Local domain name.
          Most queries for names within this domain can  use  short  names
          relative to the local domain.  If set to '.', the root domain is
          considered.  If no domain entry is present, the domain is deter‐
          mined  from  the  local hostname returned by gethostname(2); the
          domain part is taken to  be  everything  after  the  first  '.'.
          Finally,  if  the  hostname  does not contain a domain part, the
          root domain is assumed.

   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 follow‐
          ing 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 avail‐
          able for one of the domains.

          The search list is currently limited to six domains with a total
          of 256 characters.

したがってdomain xxx.net、そのドメインがある場合は、そのドメインのエントリを一覧表示せずに参照できます。ping server_name.xxx.netそれ以外の場合は、ping server_name両方が正しく解決されます。

searchdomain失敗した後に短い名前を解決しようとする別のドメインのリスト。主な違いは、リストされていない場合は明示的にリストする必要があるdomainローカルホスト名に基づいて推測することです。search

おすすめ記事