发布
社区首页 >问答首页 >resolv.conf与基文件

resolv.conf与基文件
EN

Ask Ubuntu用户
提问于 2016-08-15 22:31:20
回答 1查看 3.2K关注 0票数 3

这是我的基本文件

代码语言:javascript
代码运行次数:0
复制
root@iracavcsdbc03:~# cat /etc/resolvconf/resolv.conf.d/base
nameserver 1.1.1.1
nameserver 2.2.2.2
nameserver 3.3.3.3
nameserver 4.4.4.4

在运行resolvconf -u之后,为什么新生成的resolv.conf文件只显示3个in,而不是基文件中提到的全部4个?

代码语言:javascript
代码运行次数:0
复制
root@iracavcsdbc03:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
#
# Modify /etc/resolvconf/resolv.conf.d/base to make changes permanent!
#
nameserver 1.1.1.1
nameserver 2.2.2.2
nameserver 3.3.3.3
search infra.aic.att.net
options attempts:2
options timeout:3
EN

回答 1

Ask Ubuntu用户

发布于 2016-08-15 22:55:14

解析器的更新脚本最多将三行名称服务器写入resolv.conf.

如果您访问resolvconf的手册页,您可以找到以下信息:

代码语言:javascript
代码运行次数:0
复制
$ man resolvconf

从NAMESERVER信息部分的消费者转到第47行或libc分节,查看数字1项:

代码语言:javascript
代码运行次数:0
复制
   libc
       The most important software package that  subscribes  to  the  notification  service  is  the  GNU  C  Library
       resolver(3).   This  library  is used by many applications that need to resolve domain names.  When nameserver
       information is updated, the script /etc/resolvconf/update.d/libc generates a new version of the resolver  con‐
       figuration file, /run/resolvconf/resolv.conf, as described below.  If the new version of the file differs from
       the previously generated one then the hook scripts found in /etc/resolvconf/update-libc.d/ are executed.

       The dynamically generated resolver  configuration  file  always  starts  with  the  contents  of  /etc/resolv‐
       conf/resolv.conf.d/head  and  ends  with the contents of /etc/resolvconf/resolv.conf.d/tail.  Between head and
       tail the libc script inserts dynamic nameserver information compiled from,  first,  information  provided  for
       configured  interfaces;  second, static information from /etc/resolvconf/resolv.conf.d/base.  Specifically, it
       writes:

         1) up to three nameserver lines, ordered according to /etc/resolvconf/interface-order, possibly fewer if one
            of  the  addresses is a loopback address and the TRUNCATE_NAMESERVER_LIST_AFTER_LOOPBACK_ADDRESS environ‐
            ment variable is affirmatively set, as discussed in the ENVIRONMENT VARIABLES section;

         2) up to one search line containing the combined domain search list from all  "domain"  and  "search"  input
            lines, also ordered according to interface-order(5);

         3) all other non-comment input lines.
票数 3
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/812698

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档