1 dns (domain name system)

参考:百度、ali 云 DNS

1.1 dns 释疑

域名系统(英文:Domain Name System,缩写:DNS)是互联网的一项服务。它作为将域名和IP地址相互映射的一个分布式数据库,能够使人更方便地访问互联网。DNS使用UDP端口53。当前,对于每一级域名长度的限制是63个字符,域名总长度则不能超过253个字符。
就是管理域名的,将域名与 ip 对应上。那么什么是域名?

1.2 域名 domain name

域名(Domain Name),域名可将一个IP地址关联到一组有意义的字符上去。用户访问一个网站的时候,既可以输入该网站的IP地址,也可以输入其域名,对访问而言,两者是等价的。
简单讲就是一个映射关系,方便用户记忆。

1.2.1 域名要求、格式(组成)

树形结构,具有层次。如果把每一层看做一个节点的话,可以按照下面的方式理解域名:
节点的标记只能由3类字符组成:26个英文字母(a~z)、10个阿拉伯数字(0~9)和英文连词号(-),并且标记的长度不得超过22个字符。一个节点的域名是由从该节点到根的所有节点的标记连接组成的,中间以点分隔。最上层节点的域名称为顶级域名(TLD,Top-Level Domain),第二层节点的域名称为二级域名,依此类推。
所以,组成字符只能是字母、数字、- 三个,每个长度 22 字符。

1.2.2 域名分配和管理

域名由因特网域名与地址管理机构(ICANN,Internet Corporation for Assigned Names and Numbers)管理,这是为承担域名系统管理、IP地址分配、协议参数配置,以及主服务器系统管理等职能而设立的非盈利机构。ICANN为不同的国家或地区设置了相应的顶级域名,这些域名通常都由两个英文字母组成。例如:.uk代表英国、.fr代表法国、.jp代表日本。中国的顶级域名是.cn,.cn下的域名由CNNIC进行管理。
CNNIC规定.cn域下不能申请二级域名,三级域名的长度不得超过20个字符,并且对名称还做了下列限制:
① 注册含有“CHINA”、“CHINESE”、“CN”和“NATIONAL”等字样的域名要经国家有关部门(指部级以上单位)正式批准。
② 公众知晓的其他国家或者地区名称、外国地名和国际组织名称不得使用。
③ 县级以上(含县级)行政区划名称的全称或者缩写的使用要得到相关县级以上(含县级)人民政府正式批准。
④ 行业名称或者商品的通用名称不得使用。
⑤ 他人已在中国注册过的企业名称或者商标名称不得使用。
⑥ 对国家、社会或者公共利益有损害的名称不得使用。
⑦ 经国家有关部门(指部级以上单位)正式批准和相关县级以上(含县级)人民政府正式批准,是指相关机构要出据书面文件表示同意××××单位注册×××域名。如:要申请beijing.com.cn域名,则要提供北京市人民政府的批文。

1.2.3 顶级域名

除了代表各个国家顶级域名之外,ICANN最初还定义了7个顶级类别域名,它们分别是.com、.top、.edu、.gov、.mil、.net、.org用于企业,.edu用于教育机构,.gov用于政府机构,.mil用于军事部门,.net用于互联网络及信息中心等,.org用于非盈利性组织。

1.2.4 新的顶级域名

7个新的顶级域名分别是:firm(公司企业)、shop(商店)、web(希望突出万维网活动的实体)、arts(主要从事娱乐文化活动的实体)、rec(主要从事娱乐文化实体)、info(主要从事信息服务实体)、nom(一些希望在互联网上发布个人信息的人)。

1.3 域名系统 dns 的形成渊源

1.3.1 资源文件

早期因特网上仅有数百台主机,那时候的域名与IP地址对应只需简单地记录在一个hosts.txt文件中,这个文件由网络信息中心(NIC,Network Information Center)负责维护。任何想添加到因特网上的主机的管理员都应将其名字和地址E-mail给NIC,这个对应就会被手工加到hosts.txt文件中。每个主机管理员去NIC下载最新的hosts.txt文件放到自己的主机上,就完成了域名列表的更新。域名解析只是一个检查本机文件的本地过程。
随着因特网上主机数量的膨胀,原有的方式已经无法满足要求。现有域名系统于20世纪80年代开始投入使用。域名系统采用层次结构的名字空间,并且原来庞大的对应表被分解为不相交的、分布在因特网中的子表,这些子表称为资源文件。

1.3.2 DNS 解析

前面已经说明了域名系统名字空间的层次结构,下面来具体看一下这一结构是如何同域名系统的域名服务器(DNS,Domain Name Server)结合来实现域名解析的。
首先,根据域名系统域名空间的层次结构将其按子树划分为不同的区域,每个区域可看作是负责层次结构中这一部分节点的可管理的权力实体。例如,整个域的顶层区域由ICANN负责管理,一些国家域名及其下属的那些节点又构成了各自的区域,像.cn域就由CNNIC负责管理。而.cn域下又被划分为一些更小的区域,例如.fudan.edu.cn由复旦大学网络中心负责管理。
其次,每个区域必须有对应的域名服务器,每个区域中包含的信息存储在域名服务器上。一个区域中可有两个或多个域名服务器,这样即使其中一个域名服务器出了故障,另一个域名服务器仍然可以正常提供信息。一个域名服务器也可以同时管辖多个区域。域名服务器在接到用户发出的请求后查询自身的资源记录集合,返回用户想要得到的最终答案,或者当自身的资源记录集合中查不到所需要的答案时,返回指向另外一个域名服务器的指针,用户将继续向那个域名服务器发出请求。所以说,域名服务器不需要记录所有下属域名和主机的信息,对于其中的子域(如果存在),只需要知道子域的域名服务器即可。
资源记录是一个域名到值的绑定,它包括以下字段:域名、值、类型、分类和生命期。域名字段和值字段分别用来表示解析的内容和解析返回的结果。类型字段代表了值的种类:类型为A代表值字段是一个IP地址,即用户所要的最终答案;类型为NS代表值字段是另一个域名服务器的域名,该域名服务器能够知道如何解析域名字段所指定的域名;类型为CNAME代表值字段是由域名所指定的主机的一个别名;类型为MX代表值字段是一个邮件服务器的域名,该邮件服务器接收由域名字段所指定的域的邮件;类型PTR用于域名反解等。分类字段允许指定其他的记录类型。生命期字段用于指出该资源记录的有效期是多少。为减少域名解析时间,域名服务器会缓存一些曾经查询过的、来自其他域名服务器的资源记录。由于这些资源记录会因为更改而失效,因此域名服务器设置了生命期,到期的资源记录会被清除出缓存。
根域名服务器知道所有顶级域名的域名服务器,对应于每个顶级域名,它都有两条资源记录:一条是NS资源记录,域名字段是该顶级域名,值字段是该顶级域名解析的域名服务器的域名;另一条是A资源记录,用来指明该域名服务器的域名对应的IP地址。综合使用这两条记录,就可以知道对该域下的某个域名解析,应该继续去哪个IP地址的域名服务器寻找。第二层的域名服务器类似地存放各个第三层域名服务器的指针。第三层的域名服务器会出现A、CNAME、MX等类型的资源记录。每个域名服务器都有根域名服务器的地址记录。
最后,一个需要域名解析的用户先将该解析请求发往本地的域名服务器。如果本地的域名服务器能够解析,则直接得到结果,否则本地的域名服务器将向根域名服务器发送请求。依据根域名服务器返回的指针再查询下一层的域名服务器,依此类推,最后得到所要解析域名的IP地址。

1.3.3 域名反解

域名反解是指给出一个IP地址,找出其对应的域名,这也是利用DNS来实现的。举个例子,假设一个要反解的IP地址为202.120.225.9,系统将其改写为9.225.120.202. in-addr.arpa,然后按域名解析的方式查询。这需要在被查询主机的本地域名服务器上有一条对应于9.225.120.202.in-addr.arpa的资源记录,类型是PTR,值是其域名。

域名方式访问互联网,都需要将域名转为对应的 IP,解析域名的过程:先查找本地的 host 文件,本处的路由(比如自建的 dns 服务器、路由器上的 dns、缓存),外部的 dns (路由出口上的)(该部分存疑,具体过程有待确认)。
推荐一个 ali 云的 dns 223.5.5.5 (公共解析服务地址)

1.3.4 中文域名

看到 ali 上可以申请注册中文类的域名,可以关注一下,个人感觉不太好(当前阶段支持的不太好,尤其是搜索引擎,输入中文,不是跳网页,而是搜索查询,当然,带上http/https 是不会走搜索的)

1.4 域名服务器

域名服务器通常会有两种形式:域名服务器,以及缓存域名服务器。

1.4.1 域名服务器

下列情况需要有域名服务器:想要向全世界提供DNS信息,并对请求给出。注册了类似 exampleorg的域,而需要将IP指定到其下的主机名上。某个IP地址块需要反向DNS项(IP 到主机名)。备份服务器,或常说的从(slave) 服务器,会在主服务器出现问题或无法访问时来应答查询请求。
DNS的全称是Domain Name Server,一种程序,它保存了一张域名(domain name)和与之相对应的IP地址 (IP address)的表,以解析消息的域名。 域名是Internet上某一台计算机或计算机组的名称,用于在数据传输时标识计算机的电子方位(有时也指地理位置)。域名是由一串用点分隔的名字组成的,通常包含组织名,而且始终包括两到三个字母的后缀,以指明组织的类型或该域所在的国家或地区。之所以域名解析不需要很长时间,是因为上网接入商,比如通过阳光DNS接入北京电信,河南电信等,为了要加速用户打开网页的速度,通常在他们的DNS服务器中缓存了很多域名的DNS记录,再根据用户所在地做出网络分配。这样这个接入商的用户要打开某个网页时,接入商的服务器不需要去查询域名数据库,而是把自己缓存中的DNS记录直接使用,从而加快用户访问网站的速度。这是其最大的优点。
缺点是上网接入商ISP的缓存会存储一段时间,只在需要的时候才更新,而更新的频率没有什么标准。有的ISP可能1小时更新一次,有的可能长达一两天才更新一次。
所以新注册的域名一般来说解析反倒比较快。因为所有的ISP都没有缓存,用户访问时ISP都是要查询域名数据库,得到最新的DNS数据。
而老域名如果更改了DNS记录,但世界各地的ISP缓存数据却并不是立即更新的。这样不同ISP下的不同用户,有的可以比较快的获取新的DNS记录,有的就要等ISP缓存的下一次更新。

1.4.2 缓存域名服务器

下列情况需要有缓存域名服务器: 本地的DNS服务器能够缓存,并比直接向外界的域名服务器请求更快地得到应答。
当有人查询www.FreeBSDorg时,解析器通常会向上级ISP的域名服务器发出请求,并获得回应。如果有本地的缓存DNS服务器,查询只有在第一次被缓存DNS服务器发到外部世界。其他的查询不会发向局域网外,因为它们已经有在本地的缓存了。

采用域名解析,新注册的域名访问快,修改的老域名反而慢(毕竟不是时时刻刻都在刷新域名,清除缓存)

1.4.3 自建内部域名服务器

可以看看 https://blog.csdn.net/weixin_41843699/article/details/90350077

使用 dnsmasq https://cloud.tencent.com/developer/article/1118879 (通过Dnsmasq自建干净的DNS服务)

B站 有个视频 https://www.bilibili.com/video/BV1Z5411s7yP?p=6 (跟路飞学Linux云计算-DNS & SSH服务搭建)
image.png

image.png

image.png

image.png
image.png
image.png
image.png
image.png
image.png
image.pngimage.png
image.png
nslookup
image.png

1.5 Linux resolv.conf 文件 浅析浅析Linux resolv.conf

转载而来:
主要介绍了Linux resolv.conf的相关资料,帮助大家更好的理解和学习Linux,感兴趣的朋友可以了解下

1.5.1 简介

resolv.conf是各种操作系统域名系统解析器(DNS Resolver)的配置文件。每当一个程序需要通过域名来访问Internet上面的其它主机时,需要利用Resolver库函数将域名转换成对应的IP,然后才可进行访问。
注意,域名系统解析器(DNS Resolver)并非一个可执行程序,而是C语言的一系列库函数,用于解析resolv.conf获取域名对应的IP。关于Resolver的解释,可以使用man 3 resolver查看帮助手册。

1.5.2 配置详情

resolv.conf的配置主要包含如下几项:
(1)nameserver x.x.x.x。用于配置DNS服务器,可以使用多个nameserver指定多个DNS服务器。
(2)search domain1 domain2 baidu.com。该选项可以用来指定多个域名,中间用空格或tab键隔开。其作用是当访问的域名不能被DNS解析时,resolver会将该域名加上search指定的参数,重新请求DNS,直到被正确解析或试完search指定的域名列表为止。比如:

ping news
PING news.baidu.com (74.125.128.101) 56(84) bytes of data.
64 bytes from hg-in-f101.1e100.net (74.125.128.101): icmp_req=1 ttl=47 time=78.9 ms
64 bytes from hg-in-f101.1e100.net (74.125.128.101): icmp_req=2 ttl=47 time=63.6 ms

(3)domain mydomain.com。用于定义本地域名。在没有设置search的情况下,search默认为domain的值。
(4)sortlist IP/netmask IP。允许将得到的域名结果进行特定的排序。它的参数为IP或掩码-IP对,掩码是可选的,使用斜杠分隔。比如:
sortlist 130.155.160.0/255.255.240.0 130.155.0.0

(5)options。用于配置resolver的内置变量,不是resolv.conf的常见配置。语法格式如下:
options [option] …

option部分取值如下:
ndots:[n]:设置调用resquery()解析域名时域名至少包含的点的数量
timeout:[n]:设置等待dns服务器返回的超时时间,单位秒。默认值RES_TIMEOUT=5,参见
attempts:[n]:设置resolver向DNS服务器发起域名解析的请求次数。默认值RES_DFLRETRY=2,参见
rotate:在_res.options中设置RES_ROTATE,采用轮询方式访问nameserver,实现负载均衡
no-check-names:在_res.options中设置RES_NOCHECKNAME,禁止对传入的主机名和邮件地址进行无效字符检查,比如下划线(
),非ASCII字符或控制字符

1.5.3 注意事项

(1)search和domain不能共存,如果同时存在,以最后出现的为准。
(2)分号(;)或井号(#)开头的行为注释行;
(3)每一个配置项必须单独成行,且以关键词开头,空格分隔配置值。

1.5.4 示例

示例下面是一个resolv.conf的内容。
nameserver 202.102.192.68
nameserver 202.102.192.69
search qq.com baidu.com
options no-check-names
options attempts:1
options timeout:1

以上就是浅析Linux resolv.conf的详细内容,更多关于Linux resolv.conf的资料请关注我们其它相关文章!

1.5.5 使用命令查看 man 5 resolv.conf

  1. [root@saaspy ~]# man man
  2. [root@saaspy ~]#
  3. man man 查看 man 使用方式
  4. ...
  5. 1 Executable programs or shell commands
  6. 2 System calls (functions provided by the kernel)
  7. 3 Library calls (functions within program libraries)
  8. 4 Special files (usually found in /dev)
  9. 5 File formats and conventions eg /etc/passwd
  10. 6 Games
  11. 7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
  12. 8 System administration commands (usually only for root)
  13. 9 Kernel routines [Non standard]
  14. ...

man 5 resolv.conf

  1. RESOLV.CONF(5) Linux Programmer's Manual RESOLV.CONF(5)
  2. NAME
  3. resolv.conf - resolver configuration file
  4. SYNOPSIS
  5. /etc/resolv.conf
  6. DESCRIPTION
  7. The resolver is a set of routines in the C library that provide access to the Internet Domain Name System (DNS). The resolver configuration file contains information that is read by the resolver
  8. routines the first time they are invoked by a process. The file is designed to be human readable and contains a list of keywords with values that provide various types of resolver information.
  9. The configuration file is considered a trusted source of DNS information (e.g., DNSSEC AD-bit information will be returned unmodified from this source).
  10. If this file does not exist, only the name server on the local machine will be queried, and the search list contains the local domain name determined from the hostname.
  11. The different configuration options are:
  12. nameserver Name server IP address
  13. Internet address of a name server that the resolver should query, either an IPv4 address (in dot notation), or an IPv6 address in colon (and possibly dot) notation as per RFC 2373. Up to
  14. MAXNS (currently 3, see <resolv.h>) name servers may be listed, one per keyword. If there are multiple servers, the resolver library queries them in the order listed. If no nameserver en‐
  15. tries are present, the default is to use the name server on the local machine. (The algorithm used is to try a name server, and if the query times out, try the next, until out of name
  16. servers, then repeat trying all the name servers until a maximum number of retries are made.)
  17. search Search list for host-name lookup.
  18. By default, the search list contains one entry, the local domain name. It is determined from the local hostname returned by gethostname(2); the local domain name is taken to be everything
  19. after the first '.'. Finally, if the hostname does not contain a '.', the root domain is assumed as the local domain name.
  20. 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
  21. 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
  22. 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 do‐
  23. mains are not local, and that queries will time out if no server is available for one of the domains.
  24. If there are multiple search directives, only the search list from the last instance is used.
  25. In glibc 2.25 and earlier, the search list is limited to six domains with a total of 256 characters. Since glibc 2.26, the search list is unlimited.
  26. The domain directive is an obsolete name for the search directive that handles one search list entry only.
  27. sortlist
  28. This option allows addresses returned by gethostbyname(3) to be sorted. A sortlist is specified by IP-address-netmask pairs. The netmask is optional and defaults to the natural netmask of
  29. the net. The IP address and optional network pairs are separated by slashes. Up to 10 pairs may be specified. Here is an example:
  30. sortlist 130.155.160.0/255.255.240.0 130.155.0.0
  31. options
  32. Options allows certain internal resolver variables to be modified. The syntax is
  33. options option ...
  34. where option is one of the following:
  35. debug Sets RES_DEBUG in _res.options (effective only if glibc was built with debug support; see resolver(3)).
  36. ndots:n
  37. Sets a threshold for the number of dots which must appear in a name given to res_query(3) (see resolver(3)) before an initial absolute query will be made. The default for n is 1,
  38. meaning that if there are any dots in a name, the name will be tried first as an absolute name before any search list elements are appended to it. The value for this option is
  39. silently capped to 15.
  40. timeout:n
  41. Sets the amount of time the resolver will wait for a response from a remote name server before retrying the query via a different name server. This may not be the total time taken by
  42. any resolver API call and there is no guarantee that a single resolver API call maps to a single timeout. Measured in seconds, the default is RES_TIMEOUT (currently 5, see <re‐
  43. solv.h>). The value for this option is silently capped to 30.
  44. attempts:n
  45. Sets the number of times the resolver will send a query to its name servers before giving up and returning an error to the calling application. The default is RES_DFLRETRY (cur‐
  46. rently 2, see <resolv.h>). The value for this option is silently capped to 5.
  47. rotate Sets RES_ROTATE in _res.options, which causes round-robin selection of name servers from among those listed. This has the effect of spreading the query load among all listed
  48. servers, rather than having all clients try the first listed server first every time.
  49. no-check-names
  50. Sets RES_NOCHECKNAME in _res.options, which disables the modern BIND checking of incoming hostnames and mail names for invalid characters such as underscore (_), non-ASCII, or con‐
  51. trol characters.
  52. inet6 Sets RES_USE_INET6 in _res.options. This has the effect of trying an AAAA query before an A query inside the gethostbyname(3) function, and of mapping IPv4 responses in IPv6 "tun‐
  53. neled form" if no AAAA records are found but an A record set exists. Since glibc 2.25, this option is deprecated; applications should use getaddrinfo(3), rather than gethostby‐
  54. name(3).
  55. Some programs behave strangely when this option is turned on.
  56. ip6-bytestring (since glibc 2.3.4)
  57. Sets RES_USEBSTRING in _res.options. This causes reverse IPv6 lookups to be made using the bit-label format described in RFC 2673; if this option is not set (which is the default),
  58. then nibble format is used. This option was removed in glibc 2.25, since it relied on a backward-incompatible DNS extension that was never deployed on the Internet.
  59. ip6-dotint/no-ip6-dotint (glibc 2.3.4 to 2.24)
  60. Clear/set RES_NOIP6DOTINT in _res.options. When this option is clear (ip6-dotint), reverse IPv6 lookups are made in the (deprecated) ip6.int zone; when this option is set
  61. (no-ip6-dotint), reverse IPv6 lookups are made in the ip6.arpa zone by default. These options are available in glibc versions up to 2.24, where no-ip6-dotint is the default. Since
  62. ip6-dotint support long ago ceased to be available on the Internet, these options were removed in glibc 2.25.
  63. edns0 (since glibc 2.6)
  64. Sets RES_USE_EDNSO in _res.options. This enables support for the DNS extensions described in RFC 2671.
  65. single-request (since glibc 2.10)
  66. Sets RES_SNGLKUP in _res.options. By default, glibc performs IPv4 and IPv6 lookups in parallel since version 2.9. Some appliance DNS servers cannot handle these queries properly
  67. and make the requests time out. This option disables the behavior and makes glibc perform the IPv6 and IPv4 requests sequentially (at the cost of some slowdown of the resolving
  68. process).
  69. single-request-reopen (since glibc 2.9)
  70. Sets RES_SNGLKUPREOP in _res.options. The resolver uses the same socket for the A and AAAA requests. Some hardware mistakenly sends back only one reply. When that happens the
  71. client system will sit and wait for the second reply. Turning this option on changes this behavior so that if two requests from the same port are not handled correctly it will close
  72. the socket and open a new one before sending the second request.
  73. no-tld-query (since glibc 2.14)
  74. Sets RES_NOTLDQUERY in _res.options. This option causes res_nsearch() to not attempt to resolve an unqualified name as if it were a top level domain (TLD). This option can cause
  75. problems if the site has ``localhost'' as a TLD rather than having localhost on one or more elements of the search list. This option has no effect if neither RES_DEFNAMES or
  76. RES_DNSRCH is set.
  77. use-vc (since glibc 2.14)
  78. Sets RES_USEVC in _res.options. This option forces the use of TCP for DNS resolutions.
  79. no-reload (since glibc 2.26)
  80. Sets RES_NORELOAD in _res.options. This option disables automatic reloading of a changed configuration file.
  81. The search keyword of a system's resolv.conf file can be overridden on a per-process basis by setting the environment variable LOCALDOMAIN to a space-separated list of search domains.
  82. The options keyword of a system's resolv.conf file can be amended on a per-process basis by setting the environment variable RES_OPTIONS to a space-separated list of resolver options as explained
  83. above under options.
  84. The keyword and value must appear on a single line, and the keyword (e.g., nameserver) must start the line. The value follows the keyword, separated by white space.
  85. Lines that contain a semicolon (;) or hash character (#) in the first column are treated as comments.
  86. FILES
  87. /etc/resolv.conf, <resolv.h>
  88. SEE ALSO
  89. gethostbyname(3), resolver(3), host.conf(5), hosts(5), nsswitch.conf(5), hostname(7), named(8)
  90. Name Server Operations Guide for BIND
  91. COLOPHON
  92. This page is part of release 5.05 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at
  93. https://www.kernel.org/doc/man-pages/.
  94. 4th Berkeley Distribution 2019-10-10 RESOLV.CONF(5)

1.6 补充 dnsmasq 内容

查看 dnsmasq.conf 文件 http://oss.segetech.com/intra/srv/dnsmasq.conf

使用 jpillora/dnsmasq 作为 dns 服务器
https://hub.docker.com/r/jpillora/dnsmasq

https://github.com/jpillora/docker-dnsmasq

  1. Usage
  2. Create a /opt/dnsmasq.conf file on the Docker host
  3. #dnsmasq config, for a complete example, see:
  4. # http://oss.segetech.com/intra/srv/dnsmasq.conf
  5. #log all dns queries
  6. log-queries
  7. #dont use hosts nameservers
  8. no-resolv
  9. #use cloudflare as default nameservers, prefer 1^4
  10. server=1.0.0.1
  11. server=1.1.1.1
  12. strict-order
  13. #serve all .company queries using a specific nameserver
  14. server=/company/10.0.0.1
  15. #explicitly define host-ip mappings
  16. address=/myhost.company/10.0.0.2
  17. Run the container
  18. $ docker run \
  19. --name dnsmasq \
  20. -d \
  21. -p 53:53/udp \
  22. -p 5380:8080 \
  23. -v /opt/dnsmasq.conf:/etc/dnsmasq.conf \
  24. --log-opt "max-size=100m" \
  25. -e "HTTP_USER=foo" \
  26. -e "HTTP_PASS=bar" \
  27. --restart always \
  28. jpillora/dnsmasq
  29. $ host myhost.company <docker-host>
  30. Using domain server:
  31. Name: <docker-host>
  32. Address: <docker-host>#53
  33. Aliases:
  34. myhost.company has address 10.0.0.2

搭建成功后,就是为自己的机器设置 dns 了。
三网通 114.114.114.114 ali 223.5.5.5

1.7 解析记录类型

ali 解析的记录类型
https://help.aliyun.com/document_detail/29805.html?spm=a2c4g.11186623.0.0.30e72452u29LwW

S223.5
.5.5