⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dns-howto.txt

📁 Linux百科宝典
💻 TXT
📖 第 1 页 / 共 5 页
字号:
;directory /var/named;; type          domain                          source file or hostcache           .                               root.cacheprimary         0.0.127.in-addr.arpa            zone/127.0.0primary         177.6.206.in-addr.arpa          zone/206.6.177primary         land-5.com                      zone/land-5.com     _________________________________________________________________   5.2 /var/named/root.cache   记住这个档案是动态的,这边列出来的是旧的.你最好自己用 dig 产生一个新的     _________________________________________________________________   ; <<>> DiG 2.1 <<>>;; res options: init recurs defnam dnsrch;; got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6;; flags: qr rd ra; Ques: 1, Ans: 9, Auth: 0, Addit: 9;; QUESTIONS:;;      ., type = NS, class = IN;; ANSWERS: .       518357  NS      H.ROOT-SERVERS.NET. .       518357  NS      B.ROOT-SERVERS.NET. .       518357  NS      C.ROOT-SERVERS.NET. .       518357  NS      D.ROOT-SERVERS.NET. .       518357  NS      E.ROOT-SERVERS.NET. .       518357  NS      I.ROOT-SERVERS.NET. .       518357  NS      F.ROOT-SERVERS.NET. .       518357  NS      G.ROOT-SERVERS.NET. .       518357  NS      A.ROOT-SERVERS.NET.;; ADDITIONAL RECORDS:H.ROOT-SERVERS.NET.     165593  A       128.63.2.53B.ROOT-SERVERS.NET.     165593  A       128.9.0.107C.ROOT-SERVERS.NET.     222766  A       192.33.4.12D.ROOT-SERVERS.NET.     165593  A       128.8.10.90E.ROOT-SERVERS.NET.     165593  A       192.203.230.10I.ROOT-SERVERS.NET.     165593  A       192.36.148.17F.ROOT-SERVERS.NET.     299616  A       192.5.5.241G.ROOT-SERVERS.NET.     165593  A       192.112.36.4A.ROOT-SERVERS.NET.     165593  A       198.41.0.4;; Total query time: 250 msec;; FROM: land-5 to SERVER: default ---- 127.0.0.1;; WHEN: Fri Sep 20 10:11:22 1996;; MSG SIZE  sent: 17  rcvd: 312     _________________________________________________________________   5.3 /var/named/zone/127.0.0   不过是基本的,不能省略的 SOA 记录,以及将 127.0.0.1 指向 localhost 的记   录. 两者都是必须的.不应有其它的东西在此档案中.这个档案可能永远不必更   新,除非你的名称伺服器或管理人地址改变.     _________________________________________________________________   @               IN      SOA     land-5.com. root.land-5.com. (                                199609203       ; Serial                                28800   ; Refresh                                7200    ; Retry                                604800  ; Expire                                86400)  ; Minimum TTL                        NS      land-5.com.1                       PTR     localhost.     _________________________________________________________________   5.4 /var/named/zone/land-5.com   在这里我们看到这个必须的 SOA 记录,必要的 NS 记录. 我们可以看到它有一   个次要的名称伺服器於 ns2.psi.net. 这也应该是必要的,总是保有一个次要的   伺服器做为备份. 我们还看到做为 LAND-5 负责所有不同服务的主机,它以许多   的 CNAME 记录做到这点 (另一个做法是用 A 记录).      就像你从 SOA 记录看到的一样,区域档案以 land-5.com 开始,管理人是   root@land-5.com. 序号(serial)以 yyyymmdd 的格式加上当天的号码; 它可能   是 1996 年九月二十号那天的第六个版本的区域档案. 请记住序号必须单调地递   增,这里它只用一位数字表示当天的号码, 因此在编辑九次之後他必须等到明天   才能再编辑这个档案.[译注] 因此应该考虑用两位数字.      [译注]          读者可能会奇怪为什麽不能用 1996092010 ? 这个数字也是递增的,所以          当然可以. 但到了明天第一次编档案时该用什麽呢? 如果用 199609211          ,那麽这个数字就比 1996092010 要小了. 这样会有麻烦.因此作者建          议应用两位数字,如 1996092006.     _________________________________________________________________   @       IN      SOA     land-5.com. root.land-5.com. (                        199609206       ; serial, todays date + todays serial #                        10800           ; refresh, seconds                        7200            ; retry, seconds                        10800           ; expire, seconds                        86400 )         ; minimum, seconds                NS      land-5.com.                NS      ns2.psi.net.                MX      10 land-5.com.  ; Primary Mail Exchangerlocalhost       A       127.0.0.1router          A       206.6.177.1land-5.com.     A       206.6.177.2ns              CNAME   land-5.com.ftp             CNAME   land-5.com.www             CNAME   land-5.com.mail            CNAME   land-5.com.news            CNAME   land-5.com.funn            A       206.6.177.3illusions       CNAME   funn.land-5.com.@               TXT     "LAND-5 Corporation";;       Workstations;ws_177200       A       206.6.177.200                MX      10 land-5.com.   ; Primary Mail Hostws_177201       A       206.6.177.201                MX      10 land-5.com.   ; Primary Mail Hostws_177202       A       206.6.177.202                MX      10 land-5.com.   ; Primary Mail Hostws_177203       A       206.6.177.203                MX      10 land-5.com.   ; Primary Mail Hostws_177204       A       206.6.177.204                MX      10 land-5.com.   ; Primary Mail Hostws_177205       A       206.6.177.205                MX      10 land-5.com.   ; Primary Mail Host; {Many repetitive definitions deleted - SNIP}ws_177250       A       206.6.177.250                MX      10 land-5.com.   ; Primary Mail Hostws_177251       A       206.6.177.251                MX      10 land-5.com.   ; Primary Mail Hostws_177252       A       206.6.177.252                MX      10 land-5.com.   ; Primary Mail Hostws_177253       A       206.6.177.253                MX      10 land-5.com.   ; Primary Mail Hostws_177254       A       206.6.177.254                MX      10 land-5.com.   ; Primary Mail Host     _________________________________________________________________      另一件值得注意的事所有的工作站都没有个别的名称,而是用一开头加上最後两   位的 IP 数字. 用这样的惯例可以大量地简化维护工作,但可能有点不方便,而   且,事实上可能是你的客户不满的来源.   5.5 /var/named/zone/206.6.177   我将在後面说明这个档案.     _________________________________________________________________   @               IN      SOA     land-5.com. root.land-5.com. (                                199609206       ; Serial                                28800   ; Refresh                                7200    ; Retry                                604800  ; Expire                                86400)  ; Minimum TTL                        NS      land-5.com.                        NS      ns2.psi.net.;;       Servers;1       PTR     router.land-5.com.2       PTR     land-5.com.3       PTR     funn.land-5.com.;;       Workstations;200     PTR     ws_177200.land-5.com.201     PTR     ws_177201.land-5.com.202     PTR     ws_177202.land-5.com.203     PTR     ws_177203.land-5.com.204     PTR     ws_177204.land-5.com.205     PTR     ws_177205.land-5.com.; {Many repetitive definitions deleted - SNIP}250     PTR     ws_177250.land-5.com.251     PTR     ws_177251.land-5.com.252     PTR     ws_177252.land-5.com.253     PTR     ws_177253.land-5.com.254     PTR     ws_177254.land-5.com.     _________________________________________________________________      反向区域似乎是整个设定中最让人头痛的部份.它是在你有机器的 IP 数字时查   询机器名称用的. 例如: 你有一部 irc 伺服器接受 irc 客户端的连线. 但你   是挪威的伺服器因此你只希望接受来自挪威及其它斯堪地那维亚国家的连线. 当   你接到来自客户端的连线时 C 程式库能够告诉你连线机器的 IP 位址,因为客户   端的 IP 数字是包含在传入的网路封包中的. 然後你可以呼叫一函式   gethostbyaddr 以给定的 IP 查询机器名称. gethostbyaddr 函式会向 DNS 询   问,DNS 就会出去查询这台机器名称. 假设客户端来自 ws_177200.land-5.com   ,C 程式库提供给 irc 伺服器的 IP 是 206.6.177.200. 为找出机器的名称我   们要查询 200.177.6.206.in-addr.arpa.DNS 伺服器首先找到负责 arpa. 的伺   服器. 然後找到 in-addr.arpa. 的伺服器,再来是反过来的 206,然後是 6,   最後找到在 LAND-5 负责 177.6.206.in-addr.arpa 区域的伺服器. 由此我们得   到 200.177.6.206.in-addr.arpa 的答案是 'PTR ws_177200.land-5.com' 记录   , 意指拥有 IP 206.6.177.200 的名称是 ws_177200.land-5.com. 不过就像在   解释 prep.ai.mit.edu 如何查询时所说,这过程稍微有点不对.      回到 irc 伺服器的例子.irc 伺服器只接再来自斯堪地那维亚国家的连线,也就   是, *.no, *.se, *.dk.ws_177200.land-5.com 这个名字显然并不符合任何这   些. 因此伺服器会拒绝连线.如果没有经由 in-addr.arpa 区域到   206.2.177.200 的反向对应, 伺服器将无法查到机器名称而将会拿   206.2.177.200 来和 *.no, *.se 及 *.dk 比较,当然找不到符合的.      有些人会告诉你反向对应查询只对伺服器重要,或是一点也不重要. 当然不是:   许多 ftp, news, irc 甚至 http 伺服器将不接受无法查到名称的机器连线. 因   此事实上机器的反向名称对应是必须的.   6. 维护工作   维持它的运作.      维持它们的继续执行之外,对於 named 你还有个维护的任务得要做. 那就是维   持 root.cache 档案的更新.最简单的方法是使用 dig 程式, 首先不加任何参   数执行 dig 程式,你将会取得从你自己伺服器得到的 root.cache. 然後以   dig @rootserver . ns 查问所列出的根伺服器其中之一. 你将会注意到这份输   出看起来非常地像一个 root.cache 档案,除了一堆额外的数字以外.这些数字   不会有什麽妨碍. 把它存放到档案里(dig @e.root-servers.net . ns   >root.cache.new)并且用它来取代原本旧的 root.cache 档案.      取代了原先的档案之後要记得重新启动 named 程式.      Al Longyear 寄给我这个指令稿,它可以自动执行来更新 named.cache,为它安   装个 crontab 项目然後忘了它. 这个指令稿假设你的电子邮件可以运作而且   `hostmaster' 这个邮件别名有定义.你应该修订它以便符合你的设定.     _________________________________________________________________   #!/bin/sh## Update the nameserver cache information file once per month.# This is run automatically by a cron entry.#( echo "To: hostmaster <hostmaster>" echo "From: system <root>" echo "Subject: Automatic update of the named.boot file" echo export PATH=/sbin:/usr/sbin:/bin:/usr/bin: cd /var/named dig @rs.internic.net . ns >root.cache.new echo "The named.boot file has been updated to contain the following information:" echo cat root.cache.new chown root.root root.cache.new chmod 444 root.cache.new rm -f root.cache.old mv root.cache root.cache.old mv root.cache.new root.cache ndc restart echo echo "The nameserver has been restarted to ensure that the update is complete." echo "The previous root.cache file is now called /var/named/root.cache.old.") 2>&1 | /usr/lib/sendmail -texit 0     _________________________________________________________________      有些人可能用 ftp 从 Internic 得到 root.cache 档案. 请不要用 ftp 来更新   root.cache,上面提到的方法更为便利.   7. Bind version 8   Bind version 8 是最新的 bind 技术.我还没有尝试使用,但 David E. Smith   < [14]dave@bureau42.ml.org> 有.他写了这小节的其馀部份.      没有太多的不同.除了使用 named.conf 而不是 named.boot, 其馀都相同. 而   且 bind 8 包含了一个 perl 指令稿来将旧格式的档案转换成新的. 例如一份暂   存专用名称伺服器的 named.boot (旧格式):     _________________________________________________________________   directory /var/namedcache   .                                       root.hintprimary 0.0.127.IN-ADDR.ARPA                    127.0.0.zoneprimary localhost                               localhost.zone     _________________________________________________________________      在指令列下,於 bind8/src/bin/named 目录中键入:     _________________________________________________________________   named-bootconf.pl < named.boot > named.conf     _________________________________________________________________   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -