{"id":196361,"date":"2020-07-24T10:16:41","date_gmt":"2020-07-24T02:16:41","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=196361"},"modified":"2020-07-20T09:17:22","modified_gmt":"2020-07-20T01:17:22","slug":"ubuntu-dns","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ubuntu-dns.html","title":{"rendered":"\u914d\u7f6eUbuntu DNS\u670d\u52a1\u5668"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nDNS\uff08Domain Name Server\uff0c\u57df\u540d\u670d\u52a1\u5668\uff09\u662f\u8fdb\u884c\u57df\u540d(domain name)\u548c\u4e0e\u4e4b\u76f8\u5bf9\u5e94\u7684IP\u5730\u5740 (IP address)\u8f6c\u6362\u7684\u670d\u52a1\u5668\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u73af\u5883\u8bf4\u660e<\/strong><\/span><\/div>\n

\u670d\u52a1\u5668IP 10.68.19.61<\/p>\n

\u64cd\u4f5c\u7cfb\u7edf Ubuntu 13.04<\/p>\n

DNS\u7a0b\u5e8f Bind9<\/p>\n

\u6d4b\u8bd5\u57df\u540d mycloud.com<\/p>\n

\u76ee\u6807IP 10.68.19.134<\/p>\n

\u5b89\u88c5\u914d\u7f6eBIND9<\/strong><\/span><\/div>\n
\r\napt-get install bind9\r\n<\/pre>\n

\u603b\u5171\u9700\u8981\u7f16\u8f912\u4e2a\u6587\u4ef6\uff0c\u65b0\u589e2\u4e2a\u6587\u4ef6\uff0c\u5982\u4e0b\uff1a \u4fee\u6539\/etc\/bind\/named.conf.options\uff0c\u53bb\u6389forwarders\u7684\u6ce8\u91ca\uff0c\u5176\u4e2d\u7684IP\u4e3a\u7f51\u7edc\u8425\u8fd0\u5546\u63d0\u4f9b\u7684DNS\u670d\u52a1\u5668\uff0c\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528google\u7684DNS\u3002<\/p>\n

\r\nforwarders { \r\n       8.8.8.8; \r\n       8.8.4.4; \r\n}; \r\n<\/pre>\n

\u4fee\u6539\/etc\/bind\/named.conf.local\uff0c\u5728\u6700\u540e\u589e\u52a0\u589e\u52a0\u53cc\u5411\u89e3\u6790\u4ee3\u7801\uff1a<\/p>\n

\r\nzone \"mycloud.com\" { \r\n     type master; \r\n     file \"\/etc\/bind\/db.mycloud.com\"; \r\n}; \r\n   \r\nzone \"19.68.10.in-addr.arpa\" { \r\n     type master; \r\n     file \"\/etc\/bind\/db.10.68.19\"; \r\n}; \r\n<\/pre>\n

\u6ce8\u610f\uff1a\u5176\u4e2d\u768419.68.10\u662f\u76ee\u6807IP10.68.19.134\u7684\u524d\u4e09\u6bb5\uff0c\u8868\u793a\u4e00\u4e2aIP\u5730\u5740\u6bb5\u3002<\/p>\n

\u65b0\u589e\u57df\u540d\uff08mycloud.com\uff09\u89e3\u6790\u6587\u4ef6\/etc\/bind\/db.mycloud.com\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n

\r\n; \r\n; BIND data file for dev sites \r\n; \r\n$TTL    604800 \r\n@       IN      SOA     mycloud.com. root.mycloud.com. ( \r\n                              1         ; Serial \r\n                         604800         ; Refresh \r\n                          86400         ; Retry \r\n                        2419200         ; Expire \r\n                         604800 )       ; Negative Cache TTL \r\n; \r\n@       IN      NS      mycloud.com. \r\n@       IN      A       10.68.19.134 \r\n*.mycloud.com.  14400   IN      A       10.68.19.134 \r\n<\/pre>\n

\u65b0\u589eIP\u5730\u5740\u53cd\u5411\u89e3\u6790\u6587\u4ef6\/etc\/bind\/db.10.68.19\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n

\r\n; \r\n; BIND reverse data file for dev domains \r\n; \r\n$TTL    604800 \r\n@       IN      SOA     dev. root.dev. ( \r\n                              1         ; Serial \r\n                         604800         ; Refresh \r\n                          86400         ; Retry \r\n                        2419200         ; Expire \r\n                         604800 )       ; Negative Cache TTL \r\n; \r\n@        IN      NS      mycloud.com. \r\n134      IN      PTR     mycloud.com. \r\n<\/pre>\n
\u91cd\u542fBIND9\u670d\u52a1<\/strong><\/span><\/div>\n
\r\nservice bind9 restart\r\n<\/pre>\n
\u4fee\u6539\u672c\u673a\u914d\u7f6e<\/strong><\/span><\/div>\n

\u4fee\u6539\u6bcf\u4e00\u53f0\u9700\u8981\u4f7f\u7528\u8be5DNS\u670d\u52a1\u5668\u7684dns\u914d\u7f6e\u6587\u4ef6<\/p>\n

\r\nsudo vi \/etc\/resolv.conf\r\n<\/pre>\n

\u4fee\u6539nameserver\u4e3a\u4e0a\u8fb9\u914d\u7f6e\u597d\u7684DNS\u670d\u52a1\u5668IP<\/p>\n

\r\nnameserver 10.68.19.61\r\n<\/pre>\n

\u6b64\u4fee\u6539\u5728\u6bcf\u6b21\u91cd\u542f\u670d\u52a1\u5668\u540e\u90fd\u4f1a\u8d54\u8986\u76d6\uff0c\u53ef\u4ee5\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n

\r\nsudo vi \/etc\/resolvconf\/resolv.conf.d\/base\r\n<\/pre>\n

\u5728\u5176\u4e2d\u589e\u52a0\u4e00\u6761<\/p>\n

\r\nnameserver 10.68.19.61\r\n<\/pre>\n

\u8fd9\u6837\u91cd\u542f\u670d\u52a1\u5668\u540eDNS\u914d\u7f6e\u4f9d\u7136\u6709\u6548\uff0c\u7136\u540e\u91cd\u542fnetworking\u670d\u52a1\uff0c\u5237\u65b0DNS\u7f13\u5b58\u3002<\/p>\n

\r\nservice networking restart\r\n<\/pre>\n
\u6d4b\u8bd5\u6548\u679c<\/strong><\/span><\/div>\n
\r\nroot@controller:\/etc\/bind# nslookup \r\n> baidu.com \r\nServer:         10.68.19.61 \r\nAddress:        10.68.19.61#53 \r\n   \r\nNon-authoritative answer: \r\nName:   baidu.com \r\nAddress: 220.181.111.86 \r\nName:   baidu.com \r\nAddress: 123.125.114.144 \r\nName:   baidu.com \r\nAddress: 220.181.111.85 \r\n> mycloud.com \r\nServer:         10.68.19.61 \r\nAddress:        10.68.19.61#53 \r\n   \r\nName:   mycloud.com \r\nAddress: 10.68.19.134 \r\n> uaa.mycloud.com \r\nServer:         10.68.19.61 \r\nAddress:        10.68.19.61#53 \r\n   \r\nName:   uaa.mycloud.com \r\nAddress: 10.68.19.134\r\n<\/pre>\n

\u89e3\u6790\u60c5\u51b5\u4e3a\uff0c\u57df\u540d\uff1abaidu.com\uff0c\u5728\u672c\u5730DNS\u4e2d\u6ca1\u6709\u627e\u5230\u5339\u914d\uff0c\u901a\u8fc7DNS\uff1a8.8.8.8\u89e3\u6790\uff0cmycloud.com\u5728\u672c\u5730DNS\u4e2d\u6709\u5339\u914d\uff0c\u89e3\u6790\u523010.68.19.134.<\/p>\n","protected":false},"excerpt":{"rendered":"

\u670d\u52a1\u5668IP 10.68.19.61 \u64cd\u4f5c\u7cfb\u7edf Ubuntu 13.04 DNS\u7a0b\u5e8f Bind9 \u6d4b\u8bd5\u57df\u540d my […]<\/p>\n","protected":false},"author":668,"featured_media":196363,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-196361","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/196361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=196361"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/196361\/revisions"}],"predecessor-version":[{"id":196564,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/196361\/revisions\/196564"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/196363"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=196361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=196361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=196361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}