{"id":27,"date":"2021-01-11T08:11:03","date_gmt":"2021-01-11T00:11:03","guid":{"rendered":"https:\/\/pipikeung.dnsalias.net\/pipiwordpress\/?p=27"},"modified":"2021-01-11T08:21:36","modified_gmt":"2021-01-11T00:21:36","slug":"dns%e4%bc%ba%e6%9c%8d%e5%99%a8","status":"publish","type":"post","link":"https:\/\/pipi.dnsalias.com\/?p=27","title":{"rendered":"DNS\u4f3a\u670d\u5668"},"content":{"rendered":"<p>\u5efa\u7acbDNS\u4f3a\u670d\u5668\u5168\u7d00\u9304 ubuntu 20.04<\/p>\n<p>01 \u5b89\u88ddbind9<br \/>\n   sudo apt update<br \/>\n   sudo apt-get install bind9<\/p>\n<p>   \u6e2c\u8a66bind9\u662f\u5426\u5de5\u4f5c\uff1f<br \/>\n   nslookup google.com 127.0.0.1<br \/>\n   \uff08127.0.01\u63db\u4e0a\u4e3b\u6a5fIP\uff09<br \/>\n   \u82e5\u51fa\u73fe\ufe55<br \/>\n   Server:  \u4e3b\u6a5fIP<br \/>\n   Address: \u4e3b\u6a5fIP#53<br \/>\n   \u5247\u8b49\u5be6bind9\u5de5\u4f5c\u6b63\u5e38<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/live.staticflickr.com\/65535\/50820207822_55d2bd135f_c.jpg\" alt=\"DNS_1 height=\"480\" width=\"640\"\" \/><\/p>\n<p>02 \u914d\u7f6eBIND9<br \/>\n   \u958b\u653e\u9632\u706b\u7246\u4f7fBind9\u80fd\u901a\u904e<br \/>\n   sudo ufw allow Bind9<br \/>\n   \u914d\u7f5d\u6a94\u6848\u540d\u7a31\ufe55named.conf.options<br \/>\n   \u7528\u6587\u5b57\u7de8\u8f2f\u8edf\u4ef6\u4fee\u6539<br \/>\n   sudo nano \/etc\/bind\/named.conf.options<br \/>\n   \u52a0\u4e0a\u4ee5\u4e0b\u6587\u5b57\ufe55<br \/>\n   listen-on {<br \/>\n   192.168.1.0\/24;<br \/>\n   };<\/p>\n<p>   forwarders {<br \/>\n   8.8.8.8;<br \/>\n   8.8.4.4;<br \/>\n   };<br \/>\n   \u5728listen-on\u4e0b\u662fBind9\u7684\u670d\u52d9\u7db2\u6bb5\uff0c\u5373192.168.1.0\/24\u7684\u540c\u4e00\u7db2\u5c64\u7684\u4e3b\u6a5f\u5747\u662f\u670d\u52d9\u7bc4\u570d\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/live.staticflickr.com\/65535\/50798293516_2e813b05a5_c.jpg\" height=\"480\" width=\"640\"\" \/><\/p>\n<p>03 \u958b\u6a5f\u6642\u8d77\u52d5Bind9<br \/>\n   sudo systemctl restart bind9<\/p>\n<p>04 \u6e2c\u8a66BIND9<br \/>\n   nslookup ubuntu.com dns-server-ip-address<br \/>\n   (dns-server-ip-address\u662f\u4f60dns\u4f3a\u670d\u5668\u7684ip)<br \/>\n   \u51fa\u73fc\u7d50\u679c\ufe55<br \/>\n   Server:  dns-server-ip-address<br \/>\n   Address: dns-server-ip-address#53<\/p>\n<p>   Non-authoritative answer:<br \/>\n   Name:    ubuntu.com<br \/>\n   Address: 91.189.88.181<br \/>\n   &#8230;.<br \/>\n\u5373\u6210\u529f\u67b6\u8a2d\u4e86BIND9\u540d\u7a31\u4f3a\u670d\u5668\u4e86\ufe57<\/p>\n<p>05 \u8a2d\u5b9aBIND9\u70ba\u4e3b\u540d\u7a31\u4f3a\u670d\u5668\ufe55<br \/>\n   \u5275\u5efaDNS\u57df\u540d \uff08DNS Zone)<br \/>\n   sudo nano \/etc\/bind\/named.conf.local<br \/>\n   \u52a0\u5165\u4ee5\u4e0b\u5167\u5bb9\ufe55<br \/>\n   zone &#8220;domain-name.com&#8221; {<br \/>\n   type master;<br \/>\n   file &#8220;\/etc\/bind\/db.domain-name.com&#8221;;<br \/>\n   allow-transfer { 10.1.1.10; };<br \/>\n   also-notify    { 10.1.1.10; };<br \/>\n   };<br \/>\n   &#8216;domain-name.com&#8217; \u63db\u4e0a\u4f60\u7684\u4e3b\u6a5f\u540d\u53ca10.1.1.10\uff1b\u63db\u4e0a\u4e3b\u6a5fIP<\/p>\n<p>   \u91cd\u65b0\u8f09\u5165bind9:<br \/>\n   sudo systemctl reload bind9<\/p>\n<p>06 \u300c\u57df\u300d\u7684\u8a2d\u5b9a<br \/>\n   sudo cp \/etc\/bind\/db.local \/etc\/bind\/db.domain-name.com<br \/>\n   sudo nano \/etc\/bind\/db.domain-name.com<br \/>\n   \u540c\u6a23domain-name.com \u63db\u4e0a\u4e3b\u6a5f\u540d<\/p>\n<p>   ;<br \/>\n   $TTL    604800<br \/>\n   @       IN      SOA     ns.domain-name.com. admin.domain-name.com. (<br \/>\n   2             ; Serial<br \/>\n   604800        ; Refresh<br \/>\n   86400         ; Retry<br \/>\n   2419200       ; Expire<br \/>\n   604800 )      ; Negative Cache TTL<br \/>\n   ;<br \/>\n   pipikeung.dnsalias.net.  IN   NS ns.pipikeung.dnsalias.net.<\/p>\n<p>   pipikeung.dnsalias.net.  IN   MX 10 mail.pipikeung.dnsalias.net.<br \/>\n   pipikeung.dnsalias.net.  IN   A  xx.xx.xx.xx(\u4e3b\u6a5fIP)<br \/>\n   @       IN      NS      ns.domain-name.com.<br \/>\n   @       IN      A       10.1.1.1<br \/>\n   ns      IN      A       10.1.1.9<br \/>\n   mail    IN      A       xx.xx.xx.xx(\u4e3b\u6a5fIP)<\/p>\n<p>   domain-name.com. \u63db\u4e0a\u4e3b\u6a5f\u540d\u7a31\uff0c\u6700\u5f8c\u8981\u6709\u300c.\u300d\u53ca10.1.1.X\uff1b\u63db\u4e0a\u4e3b\u6a5fIP<\/p>\n<p>   \u91cd\u555frndc<br \/>\n   \uff08rndc=remote name-domain controller)<br \/>\n   sudo rndr reload<\/p>\n<p>07 \u6700\u5f8c\u6e2c\u8a66DNS\u4f3a\u670d\u5668<br \/>\n   nslookup domain-name.com 10.1.1.9<br \/>\n   domain-name.com \u63db\u4e0a\u4e3b\u6a5f\u540d  10.1.1.9 \u63db\u4e0a\u65b0\u8a2d\u5b9a\u540d\u7a31\u4f3a\u670d\u5668\u7684IP<br \/>\n   \u7d50\u679c\u61c9\u662f\u5728\u540d\u7a31\u4f3a\u670d\u5668\u5167\u7684\u7d00\u9304\u5373\u662f10.1.1.1<\/p>\n<p>   \u5982\u6210\u529f\u986f\u793a\u51fadb.domain-name.com\u5167\u7684\u7d00\u9304\u4fbf\u5927\u529f\u544a\u6210\ufe57\uff08domain-name.com\u7576\u7136\u8981\u6539\u6210\u4f60\u4e3b\u6a5f\u540d\u7a31\uff09<\/p>\n<p>   \u5f8c\u8a71\ufe55\u82e5\u4e3b\u6a5f\u91cf\u5c11\uff0c\u76f4\u63a5\u4ea4\u4e0a\u5c64DNS\u8a2d\u5b9a\u597d\uff0c\u4fbf\u4e00\u4e86\u767e\u4e86\ufe57\u81ea\u67b6DNS\u53ea\u662f\u60f3\u5617\u8a66\u5be6\u5207\u64cd\u4f5c\u800c\u5df2\ufe57<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5efa\u7acbDNS\u4f3a\u670d\u5668\u5168\u7d00\u9304 ubuntu 20.04 01 \u5b89\u88ddbind9 sudo &hellip; <a href=\"https:\/\/pipi.dnsalias.com\/?p=27\">\u95b1\u8b80\u5168\u6587 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-27","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/pipi.dnsalias.com\/index.php?rest_route=\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pipi.dnsalias.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pipi.dnsalias.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pipi.dnsalias.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pipi.dnsalias.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27"}],"version-history":[{"count":5,"href":"https:\/\/pipi.dnsalias.com\/index.php?rest_route=\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":32,"href":"https:\/\/pipi.dnsalias.com\/index.php?rest_route=\/wp\/v2\/posts\/27\/revisions\/32"}],"wp:attachment":[{"href":"https:\/\/pipi.dnsalias.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pipi.dnsalias.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pipi.dnsalias.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}